treewide: use splicing convenience functions

This commit is contained in:
Artturin 2022-12-24 17:44:09 +02:00
parent 665e15ee40
commit 58fa78077c
8 changed files with 25 additions and 89 deletions

View file

@ -1,31 +1,17 @@
{ config
, lib
, pkgs
, splicePackages
, newScope
, pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget
, pkgsHostHost
, pkgsTargetTarget
, generateSplicesForMkScope
, makeScopeWithSplicing
}:
let
otherSplices = {
selfBuildBuild = pkgsBuildBuild.xfce;
selfBuildHost = pkgsBuildHost.xfce;
selfBuildTarget = pkgsBuildTarget.xfce;
selfHostHost = pkgsHostHost.xfce;
selfTargetTarget = pkgsTargetTarget.xfce or { };
};
keep = _self: { };
extra = _spliced0: { };
in
lib.makeScopeWithSplicing
splicePackages
newScope
otherSplices
makeScopeWithSplicing
(generateSplicesForMkScope "xfce")
keep
extra
(self:

View file

@ -24,7 +24,7 @@ let
# - imports lua-packages.nix
# - adds spliced package sets to the package set
# - applies overrides from `packageOverrides`
({ lua, overrides, callPackage, splicePackages, newScope }: let
({ lua, overrides, callPackage, makeScopeWithSplicing }: let
luaPackagesFun = callPackage ../../../top-level/lua-packages.nix {
lua = self;
};
@ -47,9 +47,7 @@ let
overriddenPackages
overrides
];
in lib.makeScopeWithSplicing
splicePackages
newScope
in makeScopeWithSplicing
otherSplices
keep
extra

View file

@ -5,9 +5,8 @@
, db
, lib
, libffiBoot
, newScope
, makeScopeWithSplicing
, pythonPackagesExtensions
, splicePackages
, stdenv
}:
@ -71,9 +70,7 @@
overrides
]);
aliases = self: super: lib.optionalAttrs config.allowAliases (import ../../../top-level/python-aliases.nix lib self super);
in lib.makeScopeWithSplicing
splicePackages
newScope
in makeScopeWithSplicing
otherSplices
keep
extra

View file

@ -1,5 +1,4 @@
{ lib, newScope, splicePackages, steamPackagesAttr ? "steamPackages"
, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget
{ makeScopeWithSplicing, generateSplicesForMkScope
, stdenv, buildFHSUserEnv, pkgsi686Linux
}:
@ -18,19 +17,12 @@ let
glxinfo-i686 = pkgsi686Linux.glxinfo;
steam-runtime-wrapped-i686 =
if self.steamArch == "amd64"
then pkgsi686Linux.${steamPackagesAttr}.steam-runtime-wrapped
then pkgsi686Linux.steamPackages.steam-runtime-wrapped
else null;
inherit buildFHSUserEnv;
};
steamcmd = callPackage ./steamcmd.nix { };
};
otherSplices = {
selfBuildBuild = pkgsBuildBuild.${steamPackagesAttr};
selfBuildHost = pkgsBuildHost.${steamPackagesAttr};
selfBuildTarget = pkgsBuildTarget.${steamPackagesAttr};
selfHostHost = pkgsHostHost.${steamPackagesAttr};
selfTargetTarget = pkgsTargetTarget.${steamPackagesAttr} or {}; # might be missing;
};
keep = self: { };
extra = spliced0: { };
in lib.makeScopeWithSplicing splicePackages newScope otherSplices keep extra steamPackagesFun
in makeScopeWithSplicing (generateSplicesForMkScope "steamPackages") keep extra steamPackagesFun

View file

@ -1,6 +1,6 @@
{ stdenv, lib, stdenvNoCC
, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget
, buildPackages, splicePackages, newScope
, makeScopeWithSplicing, generateSplicesForMkScope
, buildPackages
, bsdSetupHook, makeSetupHook
, fetchgit, fetchurl, coreutils, groff, mandoc, byacc, flex, which, m4, gawk, substituteAll, runtimeShell
, zlib, expat, libmd
@ -24,14 +24,6 @@ let
name = "freebsd-setup-hook";
} ./setup-hook.sh;
otherSplices = {
selfBuildBuild = pkgsBuildBuild.freebsd;
selfBuildHost = pkgsBuildHost.freebsd;
selfBuildTarget = pkgsBuildTarget.freebsd;
selfHostHost = pkgsHostHost.freebsd;
selfTargetTarget = pkgsTargetTarget.freebsd or {}; # might be missing
};
mkBsdArch = stdenv': {
x86_64 = "amd64";
aarch64 = "arm64";
@ -74,10 +66,8 @@ let
done
'';
in lib.makeScopeWithSplicing
splicePackages
newScope
otherSplices
in makeScopeWithSplicing
(generateSplicesForMkScope "freebsd")
(_: {})
(_: {})
(self: let

View file

@ -1,6 +1,6 @@
{ stdenv, lib, stdenvNoCC
, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget
, buildPackages, splicePackages, newScope
, makeScopeWithSplicing, generateSplicesForMkScope
, buildPackages
, bsdSetupHook, makeSetupHook, fetchcvs, groff, mandoc, byacc, flex
, zlib
, writeShellScript, writeText, runtimeShell, symlinkJoin
@ -20,24 +20,14 @@ let
name = "netbsd-setup-hook";
} ./setup-hook.sh;
otherSplices = {
selfBuildBuild = pkgsBuildBuild.netbsd;
selfBuildHost = pkgsBuildHost.netbsd;
selfBuildTarget = pkgsBuildTarget.netbsd;
selfHostHost = pkgsHostHost.netbsd;
selfTargetTarget = pkgsTargetTarget.netbsd or {}; # might be missing
};
defaultMakeFlags = [
"MKSOFTFLOAT=${if stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft"
then "yes"
else "no"}"
];
in lib.makeScopeWithSplicing
splicePackages
newScope
otherSplices
in makeScopeWithSplicing
(generateSplicesForMkScope "netbsd")
(_: {})
(_: {})
(self: let
@ -46,7 +36,7 @@ in lib.makeScopeWithSplicing
# Why do we have splicing and yet do `nativeBuildInputs = with self; ...`?
#
# We use `lib.makeScopeWithSplicing` because this should be used for all
# We use `makeScopeWithSplicing` because this should be used for all
# nested package sets which support cross, so the inner `callPackage` works
# correctly. But for the inline packages we don't bother to use
# `callPackage`.

View file

@ -24955,13 +24955,6 @@ with pkgs;
};
xorg = let
otherSplices = {
selfBuildBuild = pkgsBuildBuild.xorg;
selfBuildHost = pkgsBuildHost.xorg;
selfBuildTarget = pkgsBuildTarget.xorg;
selfHostHost = pkgsHostHost.xorg;
selfTargetTarget = pkgsTargetTarget.xorg or { };
};
keep = _self: { };
extra = _spliced0: { };
@ -24980,10 +24973,8 @@ with pkgs;
generatedPackages = lib.callPackageWith __splicedPackages ../servers/x11/xorg/default.nix {};
xorgPackages = lib.makeScopeWithSplicing
splicePackages
newScope
otherSplices
xorgPackages = makeScopeWithSplicing
(generateSplicesForMkScope "xorg")
keep
extra
(lib.extends overrides generatedPackages);

View file

@ -1,19 +1,11 @@
{ lib
, buildPackages, pkgs, targetPackages
, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget
, stdenv, splicePackages, newScope
, generateSplicesForMkScope, makeScopeWithSplicing
, stdenv
, preLibcCrossHeaders
}:
let
otherSplices = {
selfBuildBuild = pkgsBuildBuild.darwin;
selfBuildHost = pkgsBuildHost.darwin;
selfBuildTarget = pkgsBuildTarget.darwin;
selfHostHost = pkgsHostHost.darwin;
selfTargetTarget = pkgsTargetTarget.darwin or {}; # might be missing
};
# Prefix for binaries. Customarily ends with a dash separator.
#
# TODO(@Ericson2314) Make unconditional, or optional but always true by
@ -22,7 +14,7 @@ let
(stdenv.targetPlatform.config + "-");
in
lib.makeScopeWithSplicing splicePackages newScope otherSplices (_: {}) (spliced: spliced.apple_sdk.frameworks) (self: let
makeScopeWithSplicing (generateSplicesForMkScope "darwin") (_: {}) (spliced: spliced.apple_sdk.frameworks) (self: let
inherit (self) mkDerivation callPackage;
# Must use pkgs.callPackage to avoid infinite recursion.