The LaunchDaemon file is harmless as launchd hasn’t been instructed to load it. The multi-user install script symlinks that file into
/Library/LaunchDaemons (well, it symlinks it from the default profile, not from your
~/.nix-profile) so that way it will get loaded automatically, so without that step the file does nothing.
nix-daemon.sh, this is here for the same reason the LaunchDaemon is, which is that single-user and multi-user installs both install the same
nix package, and that package is what includes this file. The single-user vs multi-user install only differs in how it sets up the system to interact with Nix.
If you really don’t want it, I suppose you could set up some wrapper derivation around
nix that explicitly filters that one path out. Maybe something like
name = "single-user-nix";
paths = [ nix ];
# remove multi-user files
postBuild = ''
# $out/etc is a symlink. Remove it and replace it with deeper links.
# There's probably a better way to do this that doesn't make assumptions
# about the contents of this symlink.
mkdir -p $out/etc/profile.d
ln -s $oldLink/profile.d/nix.sh $out/etc/profile.d/nix.sh
# $out/Library just contains the launch daemon
Having said that, I honestly think it’s much simpler just to filter
nix-daemon.sh out from your local sourcing of
Also, I do have to ask, are there any existing packages that dump files into
etc/profile.d or are you trying to come up with your own convention? My guess is the latter because AFAIK Bash has no built-in mechanism of sourcing files from a folder. Given that you’re coming up with your own convention, you could just use a different folder entirely, like