about summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2022-08-01 15:05:16 +0200
committerGitHub <noreply@github.com>2022-08-01 15:05:16 +0200
commitfe2c9ae814b7ec7c62c7a49286368214ed9a9a27 (patch)
tree1626d6e088f1bade3e99c63d5268eca9db453028 /nixos/lib
parent12a060dbbccda94940fc3385bc94e53b33eceab1 (diff)
parentacd969a4ddfdc45eca90ac4d920857ec50c5c1cd (diff)
Merge pull request #177012 from hercules-ci/nixos-modular-system
`flake.lib.nixosSystem`: Allow `nixpkgs.system` to be set modularly; improve error message
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/eval-config.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix
index 3b58ef297973e..791a03a3ba3cc 100644
--- a/nixos/lib/eval-config.nix
+++ b/nixos/lib/eval-config.nix
@@ -9,7 +9,9 @@
 # expressions are ever made modular at the top level) can just use
 # types.submodule instead of using eval-config.nix
 evalConfigArgs@
-{ # !!! system can be set modularly, would be nice to remove
+{ # !!! system can be set modularly, would be nice to remove,
+  #     however, removing or changing this default is too much
+  #     of a breaking change. To set it modularly, pass `null`.
   system ? builtins.currentSystem
 , # !!! is this argument needed any more? The pkgs argument can
   # be set modularly anyway.
@@ -48,7 +50,7 @@ let
       # this.  Since the latter defaults to the former, the former should
       # 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;
+      nixpkgs.system = lib.mkIf (system != null) (lib.mkDefault system);
 
       _module.args.pkgs = lib.mkIf (pkgs_ != null) (lib.mkForce pkgs_);
     };