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 { config
, lib , lib
, pkgs , pkgs
, splicePackages , generateSplicesForMkScope
, newScope , makeScopeWithSplicing
, pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget
, pkgsHostHost
, pkgsTargetTarget
}: }:
let let
otherSplices = {
selfBuildBuild = pkgsBuildBuild.xfce;
selfBuildHost = pkgsBuildHost.xfce;
selfBuildTarget = pkgsBuildTarget.xfce;
selfHostHost = pkgsHostHost.xfce;
selfTargetTarget = pkgsTargetTarget.xfce or { };
};
keep = _self: { }; keep = _self: { };
extra = _spliced0: { }; extra = _spliced0: { };
in in
lib.makeScopeWithSplicing makeScopeWithSplicing
splicePackages (generateSplicesForMkScope "xfce")
newScope
otherSplices
keep keep
extra extra
(self: (self:

View file

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

View file

@ -5,9 +5,8 @@
, db , db
, lib , lib
, libffiBoot , libffiBoot
, newScope , makeScopeWithSplicing
, pythonPackagesExtensions , pythonPackagesExtensions
, splicePackages
, stdenv , stdenv
}: }:
@ -71,9 +70,7 @@
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 lib.makeScopeWithSplicing in makeScopeWithSplicing
splicePackages
newScope
otherSplices otherSplices
keep keep
extra extra

View file

@ -1,5 +1,4 @@
{ lib, newScope, splicePackages, steamPackagesAttr ? "steamPackages" { makeScopeWithSplicing, generateSplicesForMkScope
, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget
, stdenv, buildFHSUserEnv, pkgsi686Linux , stdenv, buildFHSUserEnv, pkgsi686Linux
}: }:
@ -18,19 +17,12 @@ let
glxinfo-i686 = pkgsi686Linux.glxinfo; glxinfo-i686 = pkgsi686Linux.glxinfo;
steam-runtime-wrapped-i686 = steam-runtime-wrapped-i686 =
if self.steamArch == "amd64" if self.steamArch == "amd64"
then pkgsi686Linux.${steamPackagesAttr}.steam-runtime-wrapped then pkgsi686Linux.steamPackages.steam-runtime-wrapped
else null; else null;
inherit buildFHSUserEnv; inherit buildFHSUserEnv;
}; };
steamcmd = callPackage ./steamcmd.nix { }; 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: { }; keep = self: { };
extra = spliced0: { }; 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 { stdenv, lib, stdenvNoCC
, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget , makeScopeWithSplicing, generateSplicesForMkScope
, buildPackages, splicePackages, newScope , buildPackages
, bsdSetupHook, makeSetupHook , bsdSetupHook, makeSetupHook
, fetchgit, fetchurl, coreutils, groff, mandoc, byacc, flex, which, m4, gawk, substituteAll, runtimeShell , fetchgit, fetchurl, coreutils, groff, mandoc, byacc, flex, which, m4, gawk, substituteAll, runtimeShell
, zlib, expat, libmd , zlib, expat, libmd
@ -24,14 +24,6 @@ let
name = "freebsd-setup-hook"; name = "freebsd-setup-hook";
} ./setup-hook.sh; } ./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': { mkBsdArch = stdenv': {
x86_64 = "amd64"; x86_64 = "amd64";
aarch64 = "arm64"; aarch64 = "arm64";
@ -74,10 +66,8 @@ let
done done
''; '';
in lib.makeScopeWithSplicing in makeScopeWithSplicing
splicePackages (generateSplicesForMkScope "freebsd")
newScope
otherSplices
(_: {}) (_: {})
(_: {}) (_: {})
(self: let (self: let

View file

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

View file

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

View file

@ -1,19 +1,11 @@
{ lib { lib
, buildPackages, pkgs, targetPackages , buildPackages, pkgs, targetPackages
, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget , generateSplicesForMkScope, makeScopeWithSplicing
, stdenv, splicePackages, newScope , stdenv
, preLibcCrossHeaders , preLibcCrossHeaders
}: }:
let 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. # Prefix for binaries. Customarily ends with a dash separator.
# #
# TODO(@Ericson2314) Make unconditional, or optional but always true by # TODO(@Ericson2314) Make unconditional, or optional but always true by
@ -22,7 +14,7 @@ let
(stdenv.targetPlatform.config + "-"); (stdenv.targetPlatform.config + "-");
in 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; inherit (self) mkDerivation callPackage;
# Must use pkgs.callPackage to avoid infinite recursion. # Must use pkgs.callPackage to avoid infinite recursion.