nix.nixPath: Do not use environment.darwinConfig if set to null

I've personally set it to `null` to make my `system.primaryUser = null;`
configuration work on a machine with `stateVersion = 4;`.

It may apply in other use cases as well.
This commit is contained in:
Robert Hensing 2025-05-23 13:12:56 +02:00
parent 93562b65cf
commit 30845beee0

View file

@ -443,11 +443,14 @@ in
nixPath = mkOption {
type = nixPathType;
inherit (managedDefault "nix.nixPath" (
lib.optionals cfg.channel.enable [
# Include default path <darwin-config>.
{ darwin-config = "${config.environment.darwinConfig}"; }
"/nix/var/nix/profiles/per-user/root/channels"
]
lib.optionals cfg.channel.enable (
lib.optionals (config.environment.darwinConfig != null) [
# Include default path <darwin-config>.
{ darwin-config = "${config.environment.darwinConfig}"; }
] ++ [
"/nix/var/nix/profiles/per-user/root/channels"
]
)
)) default;
defaultText = lib.literalExpression ''