summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-06-16 21:45:09 +0200
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-06-23 17:18:15 +0000
commitdba73bef34190e83af483c70115d0508cceeec48 (patch)
tree0396b79466fdde25f595387ca2eaa7c90bbb3d45
parentlib.modules: Add mergeAttrDefinitionsWithPrio (diff)
downloadnixpkgs-dba73bef34190e83af483c70115d0508cceeec48.tar.gz
nixos/nixpkgs: Don't check when _module.args.pkgs is set
(cherry picked from commit 8f31bff7940ed8d8d3e250e6ab7e7bc5b6160f1d)
-rw-r--r--nixos/modules/misc/nixpkgs.nix17
1 files changed, 11 insertions, 6 deletions
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix
index 8a20e31d5137..f9d8bccea284 100644
--- a/nixos/modules/misc/nixpkgs.nix
+++ b/nixos/modules/misc/nixpkgs.nix
@@ -55,11 +55,6 @@ let
description = "An evaluation of Nixpkgs; the top level attribute set of packages";
};
- # 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;
@@ -348,7 +343,17 @@ in
finalPkgs.__splicedPackages;
};
- assertions = [
+ assertions = let
+ # Whether `pkgs` was constructed by this module. This is false when any of
+ # nixpkgs.pkgs or _module.args.pkgs is set.
+ constructedByMe =
+ # We set it with default priority and it can not be merged, so if the
+ # pkgs module argument has that priority, it's from us.
+ (lib.modules.mergeAttrDefinitionsWithPrio options._module.args).pkgs.highestPrio
+ == lib.modules.defaultOverridePriority
+ # Although, if nixpkgs.pkgs is set, we did forward it, but we did not construct it.
+ && !opt.pkgs.isDefined;
+ in [
(
let
nixosExpectedSystem =