mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-08 18:11:05 +01:00
nixos/common: guard nix.package access when nix.enable is false
When nix-darwin has `nix.enable = false` (e.g., for Determinate Nix
users), accessing `config.nix.package` throws an error:
error: nix.package: accessed when `nix.enable` is off
This regression was introduced in commit a521eab when adding the
`home.uid` option. The code restructuring changed `inherit (config.nix)
package` to be evaluated unconditionally, whereas PR #6383 had
previously ensured this worked correctly.
The fix wraps the package assignment in `mkIf config.nix.enable` to
only access `config.nix.package` when nix management is enabled in the
host OS configuration.
Fixes: #8303
This commit is contained in:
parent
6bcb2395ab
commit
1a99a515a1
1 changed files with 3 additions and 1 deletions
|
|
@ -68,7 +68,9 @@ let
|
||||||
|
|
||||||
# Make activation script use same version of Nix as system as a whole.
|
# Make activation script use same version of Nix as system as a whole.
|
||||||
# This avoids problems with Nix not being in PATH.
|
# This avoids problems with Nix not being in PATH.
|
||||||
inherit (config.nix) package;
|
# Only set package when nix is enabled to avoid errors when
|
||||||
|
# nix-darwin has nix.enable = false (e.g., Determinate Nix users).
|
||||||
|
package = mkIf config.nix.enable config.nix.package;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue