Merge pull request #40708 from obsidiansystems/nixos-nixpkgs-defaults
nixpkgs module: Fix defaulting of `localSystem` and `system`
This commit is contained in:
commit
e754f60fd9
@ -1,9 +1,10 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, options, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.nixpkgs;
|
cfg = config.nixpkgs;
|
||||||
|
opts = options.nixpgs;
|
||||||
|
|
||||||
isConfig = x:
|
isConfig = x:
|
||||||
builtins.isAttrs x || lib.isFunction x;
|
builtins.isAttrs x || lib.isFunction x;
|
||||||
@ -62,12 +63,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,7 +140,7 @@ 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 = { system = cfg.system or builtins.currentSystem; };
|
||||||
example = { system = "aarch64-linux"; config = "aarch64-unknown-linux-gnu"; };
|
example = { system = "aarch64-linux"; config = "aarch64-unknown-linux-gnu"; };
|
||||||
defaultText = literalExample
|
defaultText = literalExample
|
||||||
''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
|
''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
|
||||||
@ -179,6 +179,8 @@ in
|
|||||||
|
|
||||||
system = mkOption {
|
system = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
default = cfg.localSystem.system
|
||||||
|
or opts.localSystem.default.system;
|
||||||
example = "i686-linux";
|
example = "i686-linux";
|
||||||
description = ''
|
description = ''
|
||||||
Specifies the Nix platform type on which NixOS should be built.
|
Specifies the Nix platform type on which NixOS should be built.
|
||||||
@ -196,6 +198,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…
Reference in New Issue
Block a user