lib.makeScopeWithSplicing: provide default for keep,extra

These are often unneeded by the user.
This commit is contained in:
Artturin 2023-07-28 17:06:35 +03:00
parent cb13669b00
commit 3716ef19d8
11 changed files with 12 additions and 29 deletions

View File

@ -279,7 +279,15 @@ 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 ? (_self: {})
, extra ? (_spliced0: {})
, f
}:
let
spliced0 = splicePackages {
pkgsBuildBuild = otherSplices.selfBuildBuild;

View File

@ -5,14 +5,8 @@
, makeScopeWithSplicing
}:
let
keep = _self: { };
extra = _spliced0: { };
in
makeScopeWithSplicing {
otherSplices = generateSplicesForMkScope "xfce";
inherit keep extra;
f = (self:
let
inherit (self) callPackage;

View File

@ -39,15 +39,13 @@ let
selfHostHost = luaOnHostForHost.pkgs;
selfTargetTarget = luaOnTargetForTarget.pkgs or {};
};
keep = self: { };
extra = spliced0: {};
extensions = lib.composeManyExtensions [
generatedPackages
overriddenPackages
overrides
];
in makeScopeWithSplicing {
inherit otherSplices keep extra;
inherit otherSplices;
f = lib.extends extensions luaPackagesFun;
})
{

View File

@ -34,10 +34,8 @@ let
selfHostHost = perlOnHostForHost.pkgs;
selfTargetTarget = perlOnTargetForTarget.pkgs or {};
};
keep = self: { };
extra = spliced0: {};
in makeScopeWithSplicing {
inherit otherSplices keep extra;
inherit otherSplices;
f = perlPackagesFun;
})
{

View File

@ -48,7 +48,6 @@
};
hooks = import ./hooks/default.nix;
keep = lib.extends hooks pythonPackagesFun;
extra = _: {};
optionalExtensions = cond: as: lib.optionals cond as;
pythonExtension = import ../../../top-level/python-packages.nix;
python2Extension = import ../../../top-level/python2-packages.nix;
@ -61,7 +60,7 @@
]);
aliases = self: super: lib.optionalAttrs config.allowAliases (import ../../../top-level/python-aliases.nix lib self super);
in makeScopeWithSplicing {
inherit otherSplices keep extra;
inherit otherSplices keep;
f = lib.extends (lib.composeExtensions aliases extensions) keep;
}) {
overrides = packageOverrides;

View File

@ -336,7 +336,5 @@ let
in makeScopeWithSplicing {
otherSplices = generateSplicesForMkScope "qt5";
keep = _: {};
extra = _: {};
f = addPackages;
}

View File

@ -32,10 +32,7 @@ let
steamcmd = callPackage ./steamcmd.nix { };
};
keep = self: { };
extra = spliced0: { };
in makeScopeWithSplicing {
otherSplices = generateSplicesForMkScope "steamPackages";
inherit keep extra;
f = steamPackagesFun;
}

View File

@ -68,8 +68,6 @@ let
in makeScopeWithSplicing {
otherSplices = generateSplicesForMkScope "freebsd";
keep = _: {};
extra = _: {};
f = (self: let
inherit (self) mkDerivation;
in {

View File

@ -28,8 +28,6 @@ let
in makeScopeWithSplicing {
otherSplices = generateSplicesForMkScope "netbsd";
keep = _: {};
extra = _: {};
f = (self: let
inherit (self) mkDerivation;
in {

View File

@ -27215,9 +27215,6 @@ with pkgs;
};
xorg = let
keep = _self: { };
extra = _spliced0: { };
# Use `lib.callPackageWith __splicedPackages` rather than plain `callPackage`
# so as not to have the newly bound xorg items already in scope, which would
# have created a cycle.
@ -27234,7 +27231,6 @@ with pkgs;
xorgPackages = makeScopeWithSplicing {
otherSplices = generateSplicesForMkScope "xorg";
inherit keep extra;
f = lib.extends overrides generatedPackages;
};

View File

@ -17,7 +17,6 @@ in
makeScopeWithSplicing {
otherSplices = generateSplicesForMkScope "darwin";
keep = _: {};
extra = spliced: spliced.apple_sdk.frameworks;
f = (self: let
inherit (self) mkDerivation callPackage;