stdenv/generic: memoise passing config to mkDerivation unless overriden
This commit is contained in:
@@ -27,6 +27,7 @@ assert crossSystem == localSystem;
|
||||
|
||||
let
|
||||
inherit (localSystem) system;
|
||||
genericStdenv = import ../generic { defaultConfig = config; };
|
||||
|
||||
llvmVersion = "21"; # This needs to be updated when the default LLVM version is changed.
|
||||
sdkMajorVersion = lib.versions.major localSystem.darwinSdkVersion;
|
||||
@@ -104,15 +105,13 @@ let
|
||||
|
||||
bashNonInteractive = prevStage.bashNonInteractive or bootstrapTools;
|
||||
|
||||
thisStdenv = import ../generic {
|
||||
thisStdenv = genericStdenv {
|
||||
name = "${name}-stdenv-darwin";
|
||||
|
||||
buildPlatform = localSystem;
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
|
||||
inherit config;
|
||||
|
||||
extraBuildInputs = [ prevStage.apple-sdk ];
|
||||
inherit extraNativeBuildInputs;
|
||||
|
||||
@@ -975,15 +974,13 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check
|
||||
in
|
||||
{
|
||||
inherit config overlays;
|
||||
stdenv = import ../generic {
|
||||
stdenv = genericStdenv {
|
||||
name = "stdenv-darwin";
|
||||
|
||||
buildPlatform = localSystem;
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
|
||||
inherit config;
|
||||
|
||||
preHook = ''
|
||||
${commonPreHook}
|
||||
stripDebugFlags="-S" # llvm-strip does not support "-p" for Mach-O
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
assert crossSystem == localSystem;
|
||||
let
|
||||
genericStdenv = import ../generic { defaultConfig = config; };
|
||||
|
||||
inherit (localSystem) system;
|
||||
mkExtraBuildCommands0 = cc: ''
|
||||
rsrc="$out/resource-root"
|
||||
@@ -383,9 +385,8 @@ let
|
||||
bsdcp
|
||||
];
|
||||
shell = "${prevStage.bashNonInteractive}/bin/bash";
|
||||
stdenvNoCC = import ../generic {
|
||||
stdenvNoCC = genericStdenv {
|
||||
inherit
|
||||
config
|
||||
initialPath
|
||||
shell
|
||||
fetchurlBoot
|
||||
@@ -401,9 +402,8 @@ let
|
||||
inherit (prevStage) curl;
|
||||
inherit (config) hashedMirrors rewriteURL;
|
||||
};
|
||||
stdenv = import ../generic {
|
||||
stdenv = genericStdenv {
|
||||
inherit
|
||||
config
|
||||
initialPath
|
||||
shell
|
||||
fetchurlBoot
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
{
|
||||
defaultConfig ? null,
|
||||
}@args:
|
||||
let
|
||||
lib = import ../../../lib;
|
||||
|
||||
# By taking defaultConfig early, we can cache the result of calling
|
||||
# make-derivation.nix with config, which leads to more memoisation between
|
||||
# bootstrapping stages. We only have to re-call the file with another config
|
||||
# if stdenv-overridable is actually called with config, otherwise we stick to
|
||||
# defaultConfig. No stdenvs currently specify a non-default config, but we
|
||||
# leave it open as a possibility.
|
||||
makeDerivationFile = import ./make-derivation.nix lib;
|
||||
makeDerivationFileWithConfig =
|
||||
assert args ? defaultConfig;
|
||||
makeDerivationFile args.defaultConfig;
|
||||
|
||||
defaultNativeBuildInputs0 = [
|
||||
../../build-support/setup-hooks/no-broken-symlinks.sh
|
||||
../../build-support/setup-hooks/audit-tmpdir.sh
|
||||
@@ -39,7 +53,7 @@ let
|
||||
allowedRequisites ? null,
|
||||
extraAttrs ? { },
|
||||
overrides ? (self: super: { }),
|
||||
config,
|
||||
config ? args.defaultConfig,
|
||||
disallowedRequisites ? [ ],
|
||||
|
||||
# The `fetchurl' to use for downloading curl and its dependencies
|
||||
@@ -83,9 +97,10 @@ let
|
||||
# This is convenient to have as a parameter so the stdenv "adapters" work better
|
||||
mkDerivationFromStdenv ?
|
||||
let
|
||||
makeDerivationWithConfig = makeDerivationFile config;
|
||||
makeDerivationWithConfig' =
|
||||
if argsStdenv ? config then makeDerivationFile config else makeDerivationFileWithConfig;
|
||||
in
|
||||
stdenv: (makeDerivationWithConfig stdenv).mkDerivation,
|
||||
stdenv: (makeDerivationWithConfig' stdenv).mkDerivation,
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
@@ -121,6 +121,8 @@
|
||||
assert crossSystem == localSystem;
|
||||
|
||||
let
|
||||
genericStdenv = import ../generic { defaultConfig = config; };
|
||||
|
||||
inherit (localSystem) system;
|
||||
|
||||
isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
|
||||
@@ -174,12 +176,12 @@ let
|
||||
}:
|
||||
|
||||
let
|
||||
thisStdenv = import ../generic {
|
||||
thisStdenv = genericStdenv {
|
||||
name = "${name}-stdenv-linux";
|
||||
buildPlatform = localSystem;
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
inherit config extraNativeBuildInputs;
|
||||
inherit extraNativeBuildInputs;
|
||||
inherit (stage0) initialPath;
|
||||
preHook = ''
|
||||
# Don't patch #!/interpreter because it leads to retained
|
||||
@@ -696,13 +698,12 @@ in
|
||||
assert isBuiltByNixpkgsCompiler prevStage.patchelf;
|
||||
{
|
||||
inherit config overlays;
|
||||
stdenv = import ../generic rec {
|
||||
stdenv = genericStdenv rec {
|
||||
name = "stdenv-linux";
|
||||
|
||||
buildPlatform = localSystem;
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
inherit config;
|
||||
|
||||
preHook = commonPreHook;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
assert crossSystem == localSystem;
|
||||
|
||||
let
|
||||
genericStdenv = import ../generic { defaultConfig = config; };
|
||||
|
||||
inherit (localSystem) system;
|
||||
|
||||
shell =
|
||||
@@ -105,7 +107,7 @@ let
|
||||
extraNativeBuildInputs ? [ ],
|
||||
}:
|
||||
|
||||
import ../generic {
|
||||
genericStdenv {
|
||||
buildPlatform = localSystem;
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
@@ -145,7 +147,6 @@ let
|
||||
shell
|
||||
cc
|
||||
overrides
|
||||
config
|
||||
;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
}:
|
||||
|
||||
assert crossSystem == localSystem;
|
||||
|
||||
let
|
||||
genericStdenv = import ../generic { defaultConfig = config; };
|
||||
in
|
||||
bootStages
|
||||
++ [
|
||||
(prevStage: {
|
||||
inherit config overlays;
|
||||
|
||||
stdenv = import ../generic rec {
|
||||
inherit config;
|
||||
|
||||
stdenv = genericStdenv rec {
|
||||
inherit (prevStage.stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
preHook = ''
|
||||
|
||||
Reference in New Issue
Block a user