summary refs log tree commit diff
path: root/nixos/lib/eval-config.nix
diff options
context:
space:
mode:
authorAndrew Childs <lorne@cons.org.nz>2020-03-04 23:24:22 +0900
committerAndrew Childs <lorne@cons.org.nz>2020-03-05 20:28:31 +0900
commitce416779bbb5d86210cbf2cc5060cc81faf53c94 (patch)
tree98ac1233a10867b9374f21eda874033f151604c7 /nixos/lib/eval-config.nix
parentb83164a0499475c72affebb21e7f513e7fbd0ccd (diff)
downloadnixpkgs-ce416779bbb5d86210cbf2cc5060cc81faf53c94.tar
nixpkgs-ce416779bbb5d86210cbf2cc5060cc81faf53c94.tar.gz
nixpkgs-ce416779bbb5d86210cbf2cc5060cc81faf53c94.tar.bz2
nixpkgs-ce416779bbb5d86210cbf2cc5060cc81faf53c94.tar.lz
nixpkgs-ce416779bbb5d86210cbf2cc5060cc81faf53c94.tar.xz
nixpkgs-ce416779bbb5d86210cbf2cc5060cc81faf53c94.tar.zst
nixpkgs-ce416779bbb5d86210cbf2cc5060cc81faf53c94.zip
nixos/activation: use eval-config's system argument for nesting
This avoids a possible surprise if the user is using `nixpkgs.system`
and `nesting.children`. `nesting.children` is expected to ignore all
parent configuration so we shouldn't propagate the user-facing option
`nixpkgs.system`. To avoid doing so, we introduce a new internal
option for holding the value passed to eval-config.nix, and use that
when recursing for nesting.
Diffstat (limited to 'nixos/lib/eval-config.nix')
-rw-r--r--nixos/lib/eval-config.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix
index 77490ca3762..9892d6f160f 100644
--- a/nixos/lib/eval-config.nix
+++ b/nixos/lib/eval-config.nix
@@ -41,6 +41,12 @@ let
       # default to the argument. That way this new default could propagate all
       # they way through, but has the last priority behind everything else.
       nixpkgs.system = lib.mkDefault system;
+
+      # Stash the value of the `system` argument. When using `nesting.children`
+      # we want to have the same default value behavior (immediately above)
+      # without any interference from the user's configuration.
+      nixpkgs.initialSystem = system;
+
       _module.args.pkgs = lib.mkIf (pkgs_ != null) (lib.mkForce pkgs_);
     };
   };