Skip to content

Commit 8f31bff

Browse files
committed
nixos/nixpkgs: Don't check when _module.args.pkgs is set
1 parent 36ea2bb commit 8f31bff

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

nixos/modules/misc/nixpkgs.nix

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ let
5555
description = "An evaluation of Nixpkgs; the top level attribute set of packages";
5656
};
5757

58-
# Whether `pkgs` was constructed by this module - not if nixpkgs.pkgs or
59-
# _module.args.pkgs is set. However, determining whether _module.args.pkgs
60-
# is defined elsewhere does not seem feasible.
61-
constructedByMe = !opt.pkgs.isDefined;
62-
6358
hasBuildPlatform = opt.buildPlatform.highestPrio < (mkOptionDefault {}).priority;
6459
hasHostPlatform = opt.hostPlatform.isDefined;
6560
hasPlatform = hasHostPlatform || hasBuildPlatform;
@@ -348,7 +343,17 @@ in
348343
finalPkgs.__splicedPackages;
349344
};
350345

351-
assertions = [
346+
assertions = let
347+
# Whether `pkgs` was constructed by this module. This is false when any of
348+
# nixpkgs.pkgs or _module.args.pkgs is set.
349+
constructedByMe =
350+
# We set it with default priority and it can not be merged, so if the
351+
# pkgs module argument has that priority, it's from us.
352+
(lib.modules.mergeAttrDefinitionsWithPrio options._module.args).pkgs.highestPrio
353+
== lib.modules.defaultOverridePriority
354+
# Although, if nixpkgs.pkgs is set, we did forward it, but we did not construct it.
355+
&& !opt.pkgs.isDefined;
356+
in [
352357
(
353358
let
354359
nixosExpectedSystem =

0 commit comments

Comments
 (0)