summary refs log tree commit diff
path: root/nixos/modules/misc
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2018-09-08 09:16:41 -0400
committerGitHub <noreply@github.com>2018-09-08 09:16:41 -0400
commitca7391daf235222f220b582d43ffbbf803121779 (patch)
tree12f7c7d639fa44e057574cb1ceb9b15175158719 /nixos/modules/misc
parentbcedf59d84201679939836b5997c024497e10b1d (diff)
parent9f9723b179961e7235d8e808c4ee8eaf52e05086 (diff)
downloadnixlib-ca7391daf235222f220b582d43ffbbf803121779.tar
nixlib-ca7391daf235222f220b582d43ffbbf803121779.tar.gz
nixlib-ca7391daf235222f220b582d43ffbbf803121779.tar.bz2
nixlib-ca7391daf235222f220b582d43ffbbf803121779.tar.lz
nixlib-ca7391daf235222f220b582d43ffbbf803121779.tar.xz
nixlib-ca7391daf235222f220b582d43ffbbf803121779.tar.zst
nixlib-ca7391daf235222f220b582d43ffbbf803121779.zip
Merge pull request #46341 from obsidiansystems/fix-46320
nixpkgs module: Fix defaulting of `localSystem` and `system`
Diffstat (limited to 'nixos/modules/misc')
-rw-r--r--nixos/modules/misc/nixpkgs.nix12
1 files changed, 8 insertions, 4 deletions
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix
index 8fbe218b232a..7f9833e184ab 100644
--- a/nixos/modules/misc/nixpkgs.nix
+++ b/nixos/modules/misc/nixpkgs.nix
@@ -62,12 +62,11 @@ in
     pkgs = mkOption {
       defaultText = literalExample
         ''import "''${nixos}/.." {
-            inherit (config.nixpkgs) config overlays localSystem crossSystem;
+            inherit (cfg) config overlays localSystem crossSystem;
           }
         '';
       default = import ../../.. {
-        localSystem = { inherit (cfg) system; } // cfg.localSystem;
-        inherit (cfg) config overlays crossSystem;
+        inherit (cfg) config overlays localSystem crossSystem;
       };
       type = pkgsType;
       example = literalExample ''import <nixpkgs> {}'';
@@ -140,8 +139,11 @@ in
 
     localSystem = mkOption {
       type = types.attrs; # TODO utilize lib.systems.parsedPlatform
-      default = { system = builtins.currentSystem; };
+      default = { inherit (cfg) system; };
       example = { system = "aarch64-linux"; config = "aarch64-unknown-linux-gnu"; };
+      # Make sure that the final value has all fields for sake of other modules
+      # referring to this. TODO make `lib.systems` itself use the module system.
+      apply = lib.systems.elaborate;
       defaultText = literalExample
         ''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
       description = ''
@@ -180,6 +182,7 @@ in
     system = mkOption {
       type = types.str;
       example = "i686-linux";
+      default = { system = builtins.currentSystem; };
       description = ''
         Specifies the Nix platform type on which NixOS should be built.
         It is better to specify <code>nixpkgs.localSystem</code> instead.
@@ -196,6 +199,7 @@ in
         </programlisting>
         See <code>nixpkgs.localSystem</code> for more information.
 
+        Ignored when <code>nixpkgs.localSystem</code> is set.
         Ignored when <code>nixpkgs.pkgs</code> is set.
       '';
     };