mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-06 16:57:08 +00:00
Currently, the `bin` directory of the configured system is embedded in the `$PATH` of activation scripts, but not other elements of the default `environment.systemPath` like `/nix/var/nix/profiles/default/bin` or `/usr/local/bin`. This means that when nix-darwin is not managing the Nix installation, activation scripts like Home Manager’s that want to look up the system‐managed Nix can’t find it. Search for it on the entire `environment.systemPath` and add the appropriate directory if found. We leave the launchd `activate-system` daemon alone, because it has erroneously referred to `@out@/sw/bin` forever and therefore never got a Nix on the path to begin with. That’s a problem for another time. (The more ideal solution is probably for Home Manager activation to be driven by launchd or something, but that’s a longer‐term goal.)
17 lines
543 B
Nix
17 lines
543 B
Nix
{ config, ... }:
|
||
|
||
{
|
||
nix.enable = false;
|
||
nix.package = throw "`nix.package` used when `nix.enable` is turned off";
|
||
|
||
test = ''
|
||
printf >&2 'checking for unexpected Nix binary in /sw/bin\n'
|
||
[[ -e ${config.out}/sw/bin/nix-env ]] && exit 1
|
||
|
||
printf >&2 'checking for unexpected nix-daemon plist in /Library/LaunchDaemons\n'
|
||
[[ -e ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist ]] && exit 1
|
||
|
||
printf >&2 'checking for late‐bound Nix lookup in /activate\n'
|
||
grep nixEnvPath= ${config.out}/activate
|
||
'';
|
||
}
|