diff options
author | Adam Joseph <adam@westernsemico.com> | 2023-07-27 20:56:11 -0700 |
---|---|---|
committer | Adam Joseph <adam@westernsemico.com> | 2023-07-27 21:31:59 -0700 |
commit | cb13669b0049e795c3421987fe9367d82a0525b1 (patch) | |
tree | c20f063dd6da0e2c8d48187e5be29604c9fb926c /lib/customisation.nix | |
parent | 35abc090402873ed73b2df539472d5a9648850fa (diff) | |
download | nixpkgs-cb13669b0049e795c3421987fe9367d82a0525b1.tar nixpkgs-cb13669b0049e795c3421987fe9367d82a0525b1.tar.gz nixpkgs-cb13669b0049e795c3421987fe9367d82a0525b1.tar.bz2 nixpkgs-cb13669b0049e795c3421987fe9367d82a0525b1.tar.lz nixpkgs-cb13669b0049e795c3421987fe9367d82a0525b1.tar.xz nixpkgs-cb13669b0049e795c3421987fe9367d82a0525b1.tar.zst nixpkgs-cb13669b0049e795c3421987fe9367d82a0525b1.zip |
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.nix | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/customisation.nix b/lib/customisation.nix index a9281b1ab69..a46913dc5bd 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; |