Skip to main content
Topic: Change PATH for services in s6 (Read 829 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Change PATH for services in s6

I installed nix, and now a growing number of daemons are stored in /nix/var/nix/profiles/default/bin

How do I add that to the front of the PATH for all services?

I tried editing /etc/s6/current/bin/s6-init already, but that didn't work.  I also messed around with envfile but I don't think that allows interpolation eg `PATH="$PATH:/my/new/path"`.

Re: Change PATH for services in s6

Reply #1
I'm not sure I understand what you're trying to do here. If you want s6-rc to manage those daemons, you need to create your own source directory in /etc/s6/sv that looks like the the other services (see skarnet.org for this).

Re: Change PATH for services in s6

Reply #2
I know that much.

For example, I've got this service in /etc/s6/sv/nixd/run

Code: [Select]
#!/usr/bin/execlineb -P
fdmove -c 2 1
exec /nix/var/nix/profiles/default/bin/nix-daemon

I want /nix/var/nix/profiles/default/bin/ in the PATH so that this service and others can be shorter eg.

Code: [Select]
#!/usr/bin/execlineb -P
fdmove -c 2 1
exec nix-daemon

Re: Change PATH for services in s6

Reply #3
Oh. Exporting the path in /etc/s6/current/scripts/rc.init before s6-rc-init is called doesn't work? I would personally symlink the binaries to /usr/bin instead of changing PATH, but I guess that's up to you.

 

Re: Change PATH for services in s6

Reply #4
Quote
Exporting the path in /etc/s6/current/scripts/rc.init before s6-rc-init is called doesn't work?

I tried that and it didn't work.  s6 logged many messages it was unable to find nix-daemon.

Code: [Select]
export PATH=/nix/var/nix/profiles/default/bin:$PATH
s6-rc-init -c /etc/s6/rc/compiled /run/service

Quote
I would personally symlink the binaries to /usr/bin instead of changing PATH

That's a good suggestion, If something goes wrong during the init process I don't have to worry about accidentally running the wrong binary.  The tradeoff is that collisions are more likely when installing packages.

But this is something I'm already dealing with wrt configuration files.  I'll have to give it some thought.