From 9daae9a67af7b4d341e2c806fa274a9c0925d7cf Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 14 Feb 2025 19:05:06 +0000 Subject: [PATCH] nixos/common: forward `nix.enable` from the OS configuration (#6383) This prevents problematic references to `nix.package` when Nix management is disabled in the host OS. --- nixos/common.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/common.nix b/nixos/common.nix index 08491be9b1ef..d7343fbc4f71 100644 --- a/nixos/common.nix +++ b/nixos/common.nix @@ -34,6 +34,14 @@ let home.username = config.users.users.${name}.name; home.homeDirectory = config.users.users.${name}.home; + # Forward `nix.enable` from the OS configuration. The + # conditional is to check whether nix-darwin is new enough + # to have the `nix.enable` option; it was previously a + # `mkRemovedOptionModule` error, which we can crudely detect + # by `visible` being set to `false`. + nix.enable = + mkIf (options.nix.enable.visible or true) config.nix.enable; + # Make activation script use same version of Nix as system as a whole. # This avoids problems with Nix not being in PATH. nix.package = config.nix.package;