Merge pull request #245824 from amjoseph-nixpkgs/pr/lib/customization/makeScopeWithSplicing
lib.customisation: uncurry makeScopeWithSplicing
This commit is contained in:
commit
12cb207d20
|
@ -279,7 +279,15 @@ rec {
|
||||||
|
|
||||||
/* Like the above, but aims to support cross compilation. It's still ugly, but
|
/* Like the above, but aims to support cross compilation. It's still ugly, but
|
||||||
hopefully it helps a little bit. */
|
hopefully it helps a little bit. */
|
||||||
makeScopeWithSplicing = splicePackages: newScope: otherSplices: keep: extra: f:
|
makeScopeWithSplicing =
|
||||||
|
{ splicePackages
|
||||||
|
, newScope
|
||||||
|
}:
|
||||||
|
{ otherSplices
|
||||||
|
, keep ? (_self: {})
|
||||||
|
, extra ? (_spliced0: {})
|
||||||
|
, f
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
spliced0 = splicePackages {
|
spliced0 = splicePackages {
|
||||||
pkgsBuildBuild = otherSplices.selfBuildBuild;
|
pkgsBuildBuild = otherSplices.selfBuildBuild;
|
||||||
|
@ -295,13 +303,11 @@ rec {
|
||||||
callPackage = newScope spliced; # == self.newScope {};
|
callPackage = newScope spliced; # == self.newScope {};
|
||||||
# N.B. the other stages of the package set spliced in are *not*
|
# N.B. the other stages of the package set spliced in are *not*
|
||||||
# overridden.
|
# overridden.
|
||||||
overrideScope = g: makeScopeWithSplicing
|
overrideScope = g: (makeScopeWithSplicing
|
||||||
splicePackages
|
{ inherit splicePackages newScope; }
|
||||||
newScope
|
{ inherit otherSplices keep extra;
|
||||||
otherSplices
|
f = lib.fixedPoints.extends g f;
|
||||||
keep
|
});
|
||||||
extra
|
|
||||||
(lib.fixedPoints.extends g f);
|
|
||||||
packages = f;
|
packages = f;
|
||||||
};
|
};
|
||||||
in self;
|
in self;
|
||||||
|
|
|
@ -5,16 +5,9 @@
|
||||||
, makeScopeWithSplicing
|
, makeScopeWithSplicing
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
makeScopeWithSplicing {
|
||||||
keep = _self: { };
|
otherSplices = generateSplicesForMkScope "xfce";
|
||||||
extra = _spliced0: { };
|
f = (self:
|
||||||
|
|
||||||
in
|
|
||||||
makeScopeWithSplicing
|
|
||||||
(generateSplicesForMkScope "xfce")
|
|
||||||
keep
|
|
||||||
extra
|
|
||||||
(self:
|
|
||||||
let
|
let
|
||||||
inherit (self) callPackage;
|
inherit (self) callPackage;
|
||||||
in
|
in
|
||||||
|
@ -177,4 +170,5 @@ makeScopeWithSplicing
|
||||||
thunar-bare = self.thunar.override { thunarPlugins = [ ]; }; # added 2019-11-04
|
thunar-bare = self.thunar.override { thunarPlugins = [ ]; }; # added 2019-11-04
|
||||||
|
|
||||||
xfce4-hardware-monitor-plugin = throw "xfce.xfce4-hardware-monitor-plugin has been removed: abandoned by upstream and does not build"; # added 2023-01-15
|
xfce4-hardware-monitor-plugin = throw "xfce.xfce4-hardware-monitor-plugin has been removed: abandoned by upstream and does not build"; # added 2023-01-15
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -39,18 +39,15 @@ let
|
||||||
selfHostHost = luaOnHostForHost.pkgs;
|
selfHostHost = luaOnHostForHost.pkgs;
|
||||||
selfTargetTarget = luaOnTargetForTarget.pkgs or {};
|
selfTargetTarget = luaOnTargetForTarget.pkgs or {};
|
||||||
};
|
};
|
||||||
keep = self: { };
|
|
||||||
extra = spliced0: {};
|
|
||||||
extensions = lib.composeManyExtensions [
|
extensions = lib.composeManyExtensions [
|
||||||
generatedPackages
|
generatedPackages
|
||||||
overriddenPackages
|
overriddenPackages
|
||||||
overrides
|
overrides
|
||||||
];
|
];
|
||||||
in makeScopeWithSplicing
|
in makeScopeWithSplicing {
|
||||||
otherSplices
|
inherit otherSplices;
|
||||||
keep
|
f = lib.extends extensions luaPackagesFun;
|
||||||
extra
|
})
|
||||||
(lib.extends extensions luaPackagesFun))
|
|
||||||
{
|
{
|
||||||
overrides = packageOverrides;
|
overrides = packageOverrides;
|
||||||
lua = self;
|
lua = self;
|
||||||
|
|
|
@ -34,13 +34,10 @@ let
|
||||||
selfHostHost = perlOnHostForHost.pkgs;
|
selfHostHost = perlOnHostForHost.pkgs;
|
||||||
selfTargetTarget = perlOnTargetForTarget.pkgs or {};
|
selfTargetTarget = perlOnTargetForTarget.pkgs or {};
|
||||||
};
|
};
|
||||||
keep = self: { };
|
in makeScopeWithSplicing {
|
||||||
extra = spliced0: {};
|
inherit otherSplices;
|
||||||
in makeScopeWithSplicing
|
f = perlPackagesFun;
|
||||||
otherSplices
|
})
|
||||||
keep
|
|
||||||
extra
|
|
||||||
perlPackagesFun)
|
|
||||||
{
|
{
|
||||||
perl = self;
|
perl = self;
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
};
|
};
|
||||||
hooks = import ./hooks/default.nix;
|
hooks = import ./hooks/default.nix;
|
||||||
keep = lib.extends hooks pythonPackagesFun;
|
keep = lib.extends hooks pythonPackagesFun;
|
||||||
extra = _: {};
|
|
||||||
optionalExtensions = cond: as: lib.optionals cond as;
|
optionalExtensions = cond: as: lib.optionals cond as;
|
||||||
pythonExtension = import ../../../top-level/python-packages.nix;
|
pythonExtension = import ../../../top-level/python-packages.nix;
|
||||||
python2Extension = import ../../../top-level/python2-packages.nix;
|
python2Extension = import ../../../top-level/python2-packages.nix;
|
||||||
|
@ -60,12 +59,10 @@
|
||||||
overrides
|
overrides
|
||||||
]);
|
]);
|
||||||
aliases = self: super: lib.optionalAttrs config.allowAliases (import ../../../top-level/python-aliases.nix lib self super);
|
aliases = self: super: lib.optionalAttrs config.allowAliases (import ../../../top-level/python-aliases.nix lib self super);
|
||||||
in makeScopeWithSplicing
|
in makeScopeWithSplicing {
|
||||||
otherSplices
|
inherit otherSplices keep;
|
||||||
keep
|
f = lib.extends (lib.composeExtensions aliases extensions) keep;
|
||||||
extra
|
}) {
|
||||||
(lib.extends (lib.composeExtensions aliases extensions) keep))
|
|
||||||
{
|
|
||||||
overrides = packageOverrides;
|
overrides = packageOverrides;
|
||||||
python = self;
|
python = self;
|
||||||
});
|
});
|
||||||
|
|
|
@ -334,4 +334,7 @@ let
|
||||||
overrideScope' = lib.warn "qt5 now uses makeScopeWithSplicing which does not have \"overrideScope'\", use \"overrideScope\"." self.overrideScope;
|
overrideScope' = lib.warn "qt5 now uses makeScopeWithSplicing which does not have \"overrideScope'\", use \"overrideScope\"." self.overrideScope;
|
||||||
};
|
};
|
||||||
|
|
||||||
in makeScopeWithSplicing (generateSplicesForMkScope "qt5") (_: {}) (_: {}) addPackages
|
in makeScopeWithSplicing {
|
||||||
|
otherSplices = generateSplicesForMkScope "qt5";
|
||||||
|
f = addPackages;
|
||||||
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ let
|
||||||
|
|
||||||
steamcmd = callPackage ./steamcmd.nix { };
|
steamcmd = callPackage ./steamcmd.nix { };
|
||||||
};
|
};
|
||||||
keep = self: { };
|
in makeScopeWithSplicing {
|
||||||
extra = spliced0: { };
|
otherSplices = generateSplicesForMkScope "steamPackages";
|
||||||
in makeScopeWithSplicing (generateSplicesForMkScope "steamPackages") keep extra steamPackagesFun
|
f = steamPackagesFun;
|
||||||
|
}
|
||||||
|
|
|
@ -66,11 +66,9 @@ let
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in makeScopeWithSplicing
|
in makeScopeWithSplicing {
|
||||||
(generateSplicesForMkScope "freebsd")
|
otherSplices = generateSplicesForMkScope "freebsd";
|
||||||
(_: {})
|
f = (self: let
|
||||||
(_: {})
|
|
||||||
(self: let
|
|
||||||
inherit (self) mkDerivation;
|
inherit (self) mkDerivation;
|
||||||
in {
|
in {
|
||||||
inherit freebsdSrc;
|
inherit freebsdSrc;
|
||||||
|
@ -898,4 +896,5 @@ in makeScopeWithSplicing
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -26,11 +26,9 @@ let
|
||||||
else "no"}"
|
else "no"}"
|
||||||
];
|
];
|
||||||
|
|
||||||
in makeScopeWithSplicing
|
in makeScopeWithSplicing {
|
||||||
(generateSplicesForMkScope "netbsd")
|
otherSplices = generateSplicesForMkScope "netbsd";
|
||||||
(_: {})
|
f = (self: let
|
||||||
(_: {})
|
|
||||||
(self: let
|
|
||||||
inherit (self) mkDerivation;
|
inherit (self) mkDerivation;
|
||||||
in {
|
in {
|
||||||
|
|
||||||
|
@ -1011,4 +1009,5 @@ in makeScopeWithSplicing
|
||||||
# END MISCELLANEOUS
|
# END MISCELLANEOUS
|
||||||
#
|
#
|
||||||
|
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -27121,9 +27121,6 @@ with pkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
xorg = let
|
xorg = let
|
||||||
keep = _self: { };
|
|
||||||
extra = _spliced0: { };
|
|
||||||
|
|
||||||
# Use `lib.callPackageWith __splicedPackages` rather than plain `callPackage`
|
# Use `lib.callPackageWith __splicedPackages` rather than plain `callPackage`
|
||||||
# so as not to have the newly bound xorg items already in scope, which would
|
# so as not to have the newly bound xorg items already in scope, which would
|
||||||
# have created a cycle.
|
# have created a cycle.
|
||||||
|
@ -27138,11 +27135,10 @@ with pkgs;
|
||||||
|
|
||||||
generatedPackages = lib.callPackageWith __splicedPackages ../servers/x11/xorg/default.nix { };
|
generatedPackages = lib.callPackageWith __splicedPackages ../servers/x11/xorg/default.nix { };
|
||||||
|
|
||||||
xorgPackages = makeScopeWithSplicing
|
xorgPackages = makeScopeWithSplicing {
|
||||||
(generateSplicesForMkScope "xorg")
|
otherSplices = generateSplicesForMkScope "xorg";
|
||||||
keep
|
f = lib.extends overrides generatedPackages;
|
||||||
extra
|
};
|
||||||
(lib.extends overrides generatedPackages);
|
|
||||||
|
|
||||||
in recurseIntoAttrs xorgPackages;
|
in recurseIntoAttrs xorgPackages;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,10 @@ let
|
||||||
(stdenv.targetPlatform.config + "-");
|
(stdenv.targetPlatform.config + "-");
|
||||||
in
|
in
|
||||||
|
|
||||||
makeScopeWithSplicing (generateSplicesForMkScope "darwin") (_: {}) (spliced: spliced.apple_sdk.frameworks) (self: let
|
makeScopeWithSplicing {
|
||||||
|
otherSplices = generateSplicesForMkScope "darwin";
|
||||||
|
extra = spliced: spliced.apple_sdk.frameworks;
|
||||||
|
f = (self: let
|
||||||
inherit (self) mkDerivation callPackage;
|
inherit (self) mkDerivation callPackage;
|
||||||
|
|
||||||
# Must use pkgs.callPackage to avoid infinite recursion.
|
# Must use pkgs.callPackage to avoid infinite recursion.
|
||||||
|
@ -251,4 +254,5 @@ impure-cmds // appleSourcePackages // chooseLibs // {
|
||||||
|
|
||||||
} // lib.optionalAttrs config.allowAliases {
|
} // lib.optionalAttrs config.allowAliases {
|
||||||
builder = throw "'darwin.builder' has been changed and renamed to 'darwin.linux-builder'. The default ssh port is now 31022. Please update your configuration or override the port back to 22. See https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder"; # added 2023-07-06
|
builder = throw "'darwin.builder' has been changed and renamed to 'darwin.linux-builder'. The default ssh port is now 31022. Please update your configuration or override the port back to 22. See https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder"; # added 2023-07-06
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ in
|
||||||
newScope = extra: lib.callPackageWith (splicedPackagesWithXorg // extra);
|
newScope = extra: lib.callPackageWith (splicedPackagesWithXorg // extra);
|
||||||
|
|
||||||
# prefill 2 fields of the function for convenience
|
# prefill 2 fields of the function for convenience
|
||||||
makeScopeWithSplicing = lib.makeScopeWithSplicing splicePackages pkgs.newScope;
|
makeScopeWithSplicing = lib.makeScopeWithSplicing { inherit splicePackages; inherit (pkgs) newScope; };
|
||||||
|
|
||||||
# generate 'otherSplices' for 'makeScopeWithSplicing'
|
# generate 'otherSplices' for 'makeScopeWithSplicing'
|
||||||
generateSplicesForMkScope = attr:
|
generateSplicesForMkScope = attr:
|
||||||
|
|
Loading…
Reference in a new issue