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"`.
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).
I know that much.
For example, I've got this service in /etc/s6/sv/nixd/run
#!/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.
#!/usr/bin/execlineb -P
fdmove -c 2 1
exec nix-daemon
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.
I tried that and it didn't work. s6 logged many messages it was unable to find nix-daemon.
export PATH=/nix/var/nix/profiles/default/bin:$PATH
s6-rc-init -c /etc/s6/rc/compiled /run/service
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.