1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-31 04:04:45 +00:00

nix-tools: re‐add nixPackage

(With some tweaks to handle `nix.enable` and order it at a more
sensible position in the `$PATH`.)

The installers actually install Nix into `root`’s profile for some
reason, which means that the path’s prioritization backfires when
the script runs as root and we’re managing the Nix installation. When
running `darwin-rebuild` as a normal user, this wasn’t a problem.

Maybe we should just have a check to make sure there’s no conflicting
Nix in `root`’s profile – it seems pretty bad for `root` to
get the wrong Nix – but it would trigger for almost everyone,
which seems kind of annoying. I guess we could automatically
remove it from `root`’s profile if it matches what’s in
`/nix/var/nix/profiles/default`…

This reverts commit 02232f71c5.
This commit is contained in:
Emily 2025-02-04 03:43:24 +00:00
parent 1008b7d492
commit d07feb43b2
2 changed files with 3 additions and 1 deletions

View file

@ -5,6 +5,7 @@ let
inherit (config.system) profile;
inherit (config.environment) systemPath;
nixPath = lib.optionalString config.nix.enable (lib.concatStringsSep ":" config.nix.nixPath);
nixPackage = if config.nix.enable then config.nix.package else null;
};
darwin-uninstaller = pkgs.callPackage ../../pkgs/darwin-uninstaller { };

View file

@ -21,6 +21,7 @@
"/usr/sbin"
"/sbin"
]
, nixPackage ? null
, # This should be kept in sync with the default `nix.nixPath`.
nixPath ? lib.concatStringsSep ":" [
"darwin-config=/etc/nix-darwin/configuration.nix"
@ -29,7 +30,7 @@
}:
let
extraPath = lib.makeBinPath [ coreutils jq git ];
extraPath = lib.makeBinPath [ coreutils jq git nixPackage ];
writeProgram = name: env: src:
substituteAll ({