summaryrefslogtreecommitdiff
path: root/lib/customisation.nix
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-07-27 20:56:11 -0700
committerAdam Joseph <adam@westernsemico.com>2023-07-27 21:31:59 -0700
commitcb13669b0049e795c3421987fe9367d82a0525b1 (patch)
treec20f063dd6da0e2c8d48187e5be29604c9fb926c /lib/customisation.nix
parentMerge pull request #245458 from vale981/patch-1 (diff)
downloadnixpkgs-cb13669b0049e795c3421987fe9367d82a0525b1.tar.gz
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.
Diffstat (limited to 'lib/customisation.nix')
-rw-r--r--lib/customisation.nix14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/customisation.nix b/lib/customisation.nix
index a9281b1ab698..a46913dc5bde 100644
--- a/lib/customisation.nix
+++ b/lib/customisation.nix
@@ -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;