Skip to content

Commit

Permalink
Merge pull request #245957 from amjoseph-nixpkgs/pr/lib/customization…
Browse files Browse the repository at this point in the history
…/makeScopeWithSplicing2
  • Loading branch information
Artturin authored Aug 20, 2023
2 parents 72cde5b + 5397387 commit ec12728
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
29 changes: 21 additions & 8 deletions lib/customisation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,24 @@ rec {
};
in self;

/* backward compatibility with old uncurried form; deprecated */
makeScopeWithSplicing =
splicePackages: newScope: otherSplices: keep: extra: f:
makeScopeWithSplicing' {
inherit splicePackages newScope otherSplices keep extra f;
};

/* Like the above, but aims to support cross compilation. It's still ugly, but
hopefully it helps a little bit. */
makeScopeWithSplicing = splicePackages: newScope: otherSplices: keep: extra: f:
makeScopeWithSplicing' =
{ splicePackages
, newScope
}:
{ otherSplices
, keep ? (_self: {})
, extra ? (_spliced0: {})
, f
}:
let
spliced0 = splicePackages {
pkgsBuildBuild = otherSplices.selfBuildBuild;
Expand All @@ -296,13 +311,11 @@ rec {
callPackage = newScope spliced; # == self.newScope {};
# N.B. the other stages of the package set spliced in are *not*
# overridden.
overrideScope = g: makeScopeWithSplicing
splicePackages
newScope
otherSplices
keep
extra
(lib.fixedPoints.extends g f);
overrideScope = g: (makeScopeWithSplicing'
{ inherit splicePackages newScope; }
{ inherit otherSplices keep extra;
f = lib.fixedPoints.extends g f;
});
packages = f;
};
in self;
Expand Down
2 changes: 1 addition & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ let
noDepEntry fullDepEntry packEntry stringAfter;
inherit (self.customisation) overrideDerivation makeOverridable
callPackageWith callPackagesWith extendDerivation hydraJob
makeScope makeScopeWithSplicing;
makeScope makeScopeWithSplicing makeScopeWithSplicing';
inherit (self.derivations) lazyDerivation;
inherit (self.meta) addMetaAttrs dontDistribute setName updateName
appendToName mapDerivationAttrset setPrio lowPrio lowPrioSet hiPrio
Expand Down

0 comments on commit ec12728

Please sign in to comment.