Merge pull request #207652 from Artturin/splicenixfmt
This commit is contained in:
commit
f56de234bb
|
@ -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:
|
||||
|
|
|
@ -23,7 +23,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;
|
||||
};
|
||||
|
@ -46,9 +46,7 @@ let
|
|||
overriddenPackages
|
||||
overrides
|
||||
];
|
||||
in lib.makeScopeWithSplicing
|
||||
splicePackages
|
||||
newScope
|
||||
in makeScopeWithSplicing
|
||||
otherSplices
|
||||
keep
|
||||
extra
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -24997,13 +24997,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: { };
|
||||
|
||||
|
@ -25022,10 +25015,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);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -18,10 +18,15 @@ lib: pkgs: actuallySplice:
|
|||
|
||||
let
|
||||
|
||||
spliceReal = { pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget
|
||||
, pkgsHostHost, pkgsHostTarget
|
||||
spliceReal =
|
||||
{ pkgsBuildBuild
|
||||
, pkgsBuildHost
|
||||
, pkgsBuildTarget
|
||||
, pkgsHostHost
|
||||
, pkgsHostTarget
|
||||
, pkgsTargetTarget
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
mash =
|
||||
# Other pkgs sets
|
||||
pkgsBuildBuild // pkgsBuildTarget // pkgsHostHost // pkgsTargetTarget
|
||||
|
@ -29,7 +34,8 @@ let
|
|||
// pkgsBuildHost // pkgsHostTarget;
|
||||
merge = name: {
|
||||
inherit name;
|
||||
value = let
|
||||
value =
|
||||
let
|
||||
defaultValue = mash.${name};
|
||||
# `or {}` is for the non-derivation attsert splicing case, where `{}` is the identity.
|
||||
valueBuildBuild = pkgsBuildBuild.${name} or { };
|
||||
|
@ -49,15 +55,18 @@ let
|
|||
// (lib.optionalAttrs (pkgsBuildTarget ? ${name}) { buildTarget = valueBuildTarget; })
|
||||
// (lib.optionalAttrs (pkgsHostHost ? ${name}) { hostHost = valueHostHost; })
|
||||
// (lib.optionalAttrs (pkgsHostTarget ? ${name}) { hostTarget = valueHostTarget; })
|
||||
// (lib.optionalAttrs (pkgsTargetTarget ? ${name}) { targetTarget = valueTargetTarget;
|
||||
// (lib.optionalAttrs (pkgsTargetTarget ? ${name}) {
|
||||
targetTarget = valueTargetTarget;
|
||||
});
|
||||
};
|
||||
# Get the set of outputs of a derivation. If one derivation fails to
|
||||
# evaluate we don't want to diverge the entire splice, so we fall back
|
||||
# on {}
|
||||
tryGetOutputs = value0: let
|
||||
tryGetOutputs = value0:
|
||||
let
|
||||
inherit (builtins.tryEval value0) success value;
|
||||
in getOutputs (lib.optionalAttrs success value);
|
||||
in
|
||||
getOutputs (lib.optionalAttrs success value);
|
||||
getOutputs = value: lib.genAttrs
|
||||
(value.outputs or (lib.optional (value ? out) "out"))
|
||||
(output: value.${output});
|
||||
|
@ -72,7 +81,9 @@ let
|
|||
pkgsHostTarget = getOutputs valueHostTarget;
|
||||
pkgsTargetTarget = tryGetOutputs valueTargetTarget;
|
||||
# Just recur on plain attrsets
|
||||
} else if lib.isAttrs defaultValue then spliceReal {
|
||||
} else if lib.isAttrs defaultValue then
|
||||
spliceReal
|
||||
{
|
||||
pkgsBuildBuild = valueBuildBuild;
|
||||
pkgsBuildHost = valueBuildHost;
|
||||
pkgsBuildTarget = valueBuildTarget;
|
||||
|
@ -83,15 +94,21 @@ let
|
|||
# `__functor__` for functions instead.
|
||||
} else defaultValue;
|
||||
};
|
||||
in lib.listToAttrs (map merge (lib.attrNames mash));
|
||||
in
|
||||
lib.listToAttrs (map merge (lib.attrNames mash));
|
||||
|
||||
splicePackages = { pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget
|
||||
, pkgsHostHost, pkgsHostTarget
|
||||
splicePackages =
|
||||
{ pkgsBuildBuild
|
||||
, pkgsBuildHost
|
||||
, pkgsBuildTarget
|
||||
, pkgsHostHost
|
||||
, pkgsHostTarget
|
||||
, pkgsTargetTarget
|
||||
} @ args:
|
||||
if actuallySplice then spliceReal args else pkgsHostTarget;
|
||||
|
||||
splicedPackages = splicePackages {
|
||||
splicedPackages = splicePackages
|
||||
{
|
||||
inherit (pkgs)
|
||||
pkgsBuildBuild pkgsBuildHost pkgsBuildTarget
|
||||
pkgsHostHost pkgsHostTarget
|
||||
|
@ -109,7 +126,10 @@ let
|
|||
};
|
||||
|
||||
splicedPackagesWithXorg = splicedPackages // builtins.removeAttrs splicedPackages.xorg [
|
||||
"callPackage" "newScope" "overrideScope" "packages"
|
||||
"callPackage"
|
||||
"newScope"
|
||||
"overrideScope"
|
||||
"packages"
|
||||
];
|
||||
|
||||
in
|
||||
|
@ -126,6 +146,24 @@ in
|
|||
|
||||
newScope = extra: lib.callPackageWith (splicedPackagesWithXorg // extra);
|
||||
|
||||
# prefill 2 fields of the function for convenience
|
||||
makeScopeWithSplicing = lib.makeScopeWithSplicing splicePackages pkgs.newScope;
|
||||
|
||||
# generate 'otherSplices' for 'makeScopeWithSplicing'
|
||||
generateSplicesForMkScope = attr:
|
||||
let
|
||||
split = X: lib.splitString "." "${X}.${attr}";
|
||||
in
|
||||
{
|
||||
# nulls should never be reached
|
||||
selfBuildBuild = lib.attrByPath (split "pkgsBuildBuild") null pkgs;
|
||||
selfBuildHost = lib.attrByPath (split "pkgsBuildHost") null pkgs;
|
||||
selfBuildTarget = lib.attrByPath (split "pkgsBuildTarget") null pkgs;
|
||||
selfHostHost = lib.attrByPath (split "pkgsHostHost") null pkgs;
|
||||
selfHostTarget = lib.attrByPath (split "pkgsHostTarget") null pkgs;
|
||||
selfTargetTarget = lib.attrByPath (split "pkgsTargetTarget") { } pkgs;
|
||||
};
|
||||
|
||||
# Haskell package sets need this because they reimplement their own
|
||||
# `newScope`.
|
||||
__splicedPackages = splicedPackages // { recurseForDerivations = false; };
|
||||
|
|
Loading…
Reference in a new issue