From 1a99a515a1d32a67bac668b626629b5fd797ff8d Mon Sep 17 00:00:00 2001 From: David Date: Fri, 5 Dec 2025 16:59:02 +0100 Subject: [PATCH] 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 --- nixos/common.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/common.nix b/nixos/common.nix index be243538f..3edecffbe 100644 --- a/nixos/common.nix +++ b/nixos/common.nix @@ -68,7 +68,9 @@ let # Make activation script use same version of Nix as system as a whole. # 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; }; }; }