Merge pull request #46341 from obsidiansystems/fix-46320
nixpkgs module: Fix defaulting of `localSystem` and `system`
This commit is contained in:
commit
ca7391daf2
@ -36,7 +36,11 @@ let
|
|||||||
_file = ./eval-config.nix;
|
_file = ./eval-config.nix;
|
||||||
key = _file;
|
key = _file;
|
||||||
config = {
|
config = {
|
||||||
nixpkgs.localSystem = lib.mkDefault { inherit system; };
|
# Explicit `nixpkgs.system` or `nixpkgs.localSystem` should override
|
||||||
|
# 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;
|
||||||
_module.args.pkgs = lib.mkIf (pkgs_ != null) (lib.mkForce pkgs_);
|
_module.args.pkgs = lib.mkIf (pkgs_ != null) (lib.mkForce pkgs_);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -62,12 +62,11 @@ in
|
|||||||
pkgs = mkOption {
|
pkgs = mkOption {
|
||||||
defaultText = literalExample
|
defaultText = literalExample
|
||||||
''import "''${nixos}/.." {
|
''import "''${nixos}/.." {
|
||||||
inherit (config.nixpkgs) config overlays localSystem crossSystem;
|
inherit (cfg) config overlays localSystem crossSystem;
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
default = import ../../.. {
|
default = import ../../.. {
|
||||||
localSystem = { inherit (cfg) system; } // cfg.localSystem;
|
inherit (cfg) config overlays localSystem crossSystem;
|
||||||
inherit (cfg) config overlays crossSystem;
|
|
||||||
};
|
};
|
||||||
type = pkgsType;
|
type = pkgsType;
|
||||||
example = literalExample ''import <nixpkgs> {}'';
|
example = literalExample ''import <nixpkgs> {}'';
|
||||||
@ -140,8 +139,11 @@ in
|
|||||||
|
|
||||||
localSystem = mkOption {
|
localSystem = mkOption {
|
||||||
type = types.attrs; # TODO utilize lib.systems.parsedPlatform
|
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"; };
|
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
|
defaultText = literalExample
|
||||||
''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
|
''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
|
||||||
description = ''
|
description = ''
|
||||||
@ -180,6 +182,7 @@ in
|
|||||||
system = mkOption {
|
system = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
example = "i686-linux";
|
example = "i686-linux";
|
||||||
|
default = { system = builtins.currentSystem; };
|
||||||
description = ''
|
description = ''
|
||||||
Specifies the Nix platform type on which NixOS should be built.
|
Specifies the Nix platform type on which NixOS should be built.
|
||||||
It is better to specify <code>nixpkgs.localSystem</code> instead.
|
It is better to specify <code>nixpkgs.localSystem</code> instead.
|
||||||
@ -196,6 +199,7 @@ in
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
See <code>nixpkgs.localSystem</code> for more information.
|
See <code>nixpkgs.localSystem</code> for more information.
|
||||||
|
|
||||||
|
Ignored when <code>nixpkgs.localSystem</code> is set.
|
||||||
Ignored when <code>nixpkgs.pkgs</code> is set.
|
Ignored when <code>nixpkgs.pkgs</code> is set.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user