diff options
author | Robert Hensing <robert@roberthensing.nl> | 2022-10-20 11:18:13 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2022-10-20 11:19:20 +0200 |
commit | 1e9864c85ebe6cf2fcc4dd0a7e5307a491ab549b (patch) | |
tree | f7485cd780c98b3cbfba57a5771d912de5d93cd1 /nixos/modules/misc/nixpkgs.nix | |
parent | 028b21a5976f1b8006b20df4c9da01f75318add9 (diff) |
nixos/nixpkgs: Only error when nixpkgs options are actually used
Diffstat (limited to 'nixos/modules/misc/nixpkgs.nix')
-rw-r--r-- | nixos/modules/misc/nixpkgs.nix | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index e8becb6bf8cc7..5bd7eb1408b2a 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -55,6 +55,11 @@ let check = builtins.isAttrs; }; + # Whether `pkgs` was constructed by this module - not if nixpkgs.pkgs or + # _module.args.pkgs is set. However, determining whether _module.args.pkgs + # is defined elsewhere does not seem feasible. + constructedByMe = !opt.pkgs.isDefined; + hasBuildPlatform = opt.buildPlatform.highestPrio < (mkOptionDefault {}).priority; hasHostPlatform = opt.hostPlatform.isDefined; hasPlatform = hasHostPlatform || hasBuildPlatform; @@ -358,7 +363,7 @@ in } ) { - assertion = hasPlatform -> legacyOptionsDefined == []; + assertion = constructedByMe -> hasPlatform -> legacyOptionsDefined == []; message = '' Your system configures nixpkgs with the platform parameter${optionalString hasBuildPlatform "s"}: ${hostPlatformLine |