diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 8fbe218b232a..29019ed3d552 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -1,9 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, options, lib, pkgs, ... }: with lib; let cfg = config.nixpkgs; + opts = options.nixpgs; isConfig = x: builtins.isAttrs x || lib.isFunction x; @@ -62,12 +63,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 {}''; @@ -140,7 +140,7 @@ in localSystem = mkOption { 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"; }; defaultText = literalExample ''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform''; @@ -179,6 +179,8 @@ in system = mkOption { type = types.str; + default = cfg.localSystem.system + or opts.localSystem.default.system; example = "i686-linux"; description = '' Specifies the Nix platform type on which NixOS should be built. @@ -196,6 +198,7 @@ in See nixpkgs.localSystem for more information. + Ignored when nixpkgs.localSystem is set. Ignored when nixpkgs.pkgs is set. ''; };