Merge pull request #81241 from thefloweringash/nesting-system

nixos/activation: propagate system to nested configurations

Changed files
+19 -4
nixos
lib
modules
misc
system
activation
tests
+6
nixos/lib/eval-config.nix
···
# 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_);
};
};
+8
nixos/modules/misc/nixpkgs.nix
···
Ignored when <code>nixpkgs.pkgs</code> is set.
'';
};
+
+
initialSystem = mkOption {
+
type = types.str;
+
internal = true;
+
description = ''
+
Preserved value of <literal>system</literal> passed to <literal>eval-config.nix</literal>.
+
'';
+
};
};
config = {
+1
nixos/modules/system/activation/top-level.nix
···
map (childConfig:
(import ../../../lib/eval-config.nix {
inherit baseModules;
+
system = config.nixpkgs.initialSystem;
modules =
(optionals inheritParent modules)
++ [ ./no-clone.nix ]
+4 -4
nixos/tests/nesting.nix
···
)
clone.succeed("cowsay hey")
clone.succeed("hello")
-
-
children.wait_for_unit("default.target")
-
children.succeed("cowsay hey")
-
children.fail("hello")
+
+
children.wait_for_unit("default.target")
+
children.succeed("cowsay hey")
+
children.fail("hello")
with subtest("Nested children do not inherit from parent"):
children.succeed(