···3636 _file = ./eval-config.nix;
3737 key = _file;
3838 config = {
3939- nixpkgs.localSystem = lib.mkDefault { inherit system; };
3939+ # Explicit `nixpkgs.system` or `nixpkgs.localSystem` should override
4040+ # this. Since the latter defaults to the former, the former should
4141+ # default to the argument. That way this new default could propagate all
4242+ # they way through, but has the last priority behind everything else.
4343+ nixpkgs.system = lib.mkDefault system;
4044 _module.args.pkgs = lib.mkIf (pkgs_ != null) (lib.mkForce pkgs_);
4145 };
4246 };
+8-4
nixos/modules/misc/nixpkgs.nix
···6262 pkgs = mkOption {
6363 defaultText = literalExample
6464 ''import "''${nixos}/.." {
6565- inherit (config.nixpkgs) config overlays localSystem crossSystem;
6565+ inherit (cfg) config overlays localSystem crossSystem;
6666 }
6767 '';
6868 default = import ../../.. {
6969- localSystem = { inherit (cfg) system; } // cfg.localSystem;
7070- inherit (cfg) config overlays crossSystem;
6969+ inherit (cfg) config overlays localSystem crossSystem;
7170 };
7271 type = pkgsType;
7372 example = literalExample ''import <nixpkgs> {}'';
···140139141140 localSystem = mkOption {
142141 type = types.attrs; # TODO utilize lib.systems.parsedPlatform
143143- default = { system = builtins.currentSystem; };
142142+ default = { inherit (cfg) system; };
144143 example = { system = "aarch64-linux"; config = "aarch64-unknown-linux-gnu"; };
144144+ # Make sure that the final value has all fields for sake of other modules
145145+ # referring to this. TODO make `lib.systems` itself use the module system.
146146+ apply = lib.systems.elaborate;
145147 defaultText = literalExample
146148 ''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
147149 description = ''
···180182 system = mkOption {
181183 type = types.str;
182184 example = "i686-linux";
185185+ default = { system = builtins.currentSystem; };
183186 description = ''
184187 Specifies the Nix platform type on which NixOS should be built.
185188 It is better to specify <code>nixpkgs.localSystem</code> instead.
···196199 </programlisting>
197200 See <code>nixpkgs.localSystem</code> for more information.
198201202202+ Ignored when <code>nixpkgs.localSystem</code> is set.
199203 Ignored when <code>nixpkgs.pkgs</code> is set.
200204 '';
201205 };