lib.customisation: uncurry makeScopeWithSplicing

Deeply-curried functions are pretty error-prone in untyped languages
like Nix.  This is a particularly bad case because
`top-level/splice.nix` *also* declares a makeScopeWithSplicing, but
it takes *two fewer arguments*.

Let's switch to attrset-passing form, to provide some minimal level
of sanity-checking.
This commit is contained in:
Adam Joseph 2023-07-27 20:56:11 -07:00
parent 35abc09040
commit cb13669b00
12 changed files with 62 additions and 52 deletions

View file

@ -279,7 +279,7 @@ rec {
/* 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, extra, f }:
let
spliced0 = splicePackages {
pkgsBuildBuild = otherSplices.selfBuildBuild;
@ -295,13 +295,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;