freshBootstrapTools.bootstrapTools: extract as a sort of package
This commit is contained in:
parent
052ecdbfae
commit
2587d88ee8
35
pkgs/stdenv/linux/bootstrap-tools/default.nix
Normal file
35
pkgs/stdenv/linux/bootstrap-tools/default.nix
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
libc,
|
||||||
|
config,
|
||||||
|
system,
|
||||||
|
bootstrapFiles,
|
||||||
|
isFromBootstrapFiles ? false,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
maybeDenoteProvenance = lib.optionalAttrs isFromBootstrapFiles {
|
||||||
|
passthru = {
|
||||||
|
inherit isFromBootstrapFiles;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
maybeContentAddressed = lib.optionalAttrs config.contentAddressedByDefault {
|
||||||
|
__contentAddressed = true;
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
};
|
||||||
|
|
||||||
|
args = {
|
||||||
|
inherit system bootstrapFiles;
|
||||||
|
extraAttrs = maybeContentAddressed;
|
||||||
|
};
|
||||||
|
result =
|
||||||
|
if libc == "glibc" then
|
||||||
|
import ./glibc.nix args
|
||||||
|
else if libc == "musl" then
|
||||||
|
import ./musl.nix args
|
||||||
|
else
|
||||||
|
throw "unsupported libc";
|
||||||
|
in
|
||||||
|
result // maybeDenoteProvenance
|
@ -139,14 +139,11 @@ let
|
|||||||
|
|
||||||
|
|
||||||
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
|
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
|
||||||
bootstrapTools = (import (if localSystem.libc == "musl" then ./bootstrap-tools/musl.nix else ./bootstrap-tools/glibc.nix) {
|
bootstrapTools = import ./bootstrap-tools {
|
||||||
inherit system bootstrapFiles;
|
inherit (localSystem) libc system;
|
||||||
extraAttrs = lib.optionalAttrs config.contentAddressedByDefault {
|
inherit lib bootstrapFiles config;
|
||||||
__contentAddressed = true;
|
isFromBootstrapFiles = true;
|
||||||
outputHashAlgo = "sha256";
|
};
|
||||||
outputHashMode = "recursive";
|
|
||||||
};
|
|
||||||
}) // { passthru.isFromBootstrapFiles = true; };
|
|
||||||
|
|
||||||
getLibc = stage: stage.${localSystem.libc};
|
getLibc = stage: stage.${localSystem.libc};
|
||||||
|
|
||||||
|
@ -49,26 +49,11 @@ rec {
|
|||||||
|
|
||||||
inherit (build) bootstrapFiles;
|
inherit (build) bootstrapFiles;
|
||||||
|
|
||||||
bootstrapTools =
|
bootstrapTools = import ./bootstrap-tools {
|
||||||
let extraAttrs = lib.optionalAttrs
|
inherit (stdenv.buildPlatform) system; # Used to determine where to build
|
||||||
config.contentAddressedByDefault
|
inherit (stdenv.hostPlatform) libc;
|
||||||
{
|
inherit lib bootstrapFiles config;
|
||||||
__contentAddressed = true;
|
};
|
||||||
outputHashAlgo = "sha256";
|
|
||||||
outputHashMode = "recursive";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
if (stdenv.hostPlatform.libc == "glibc") then
|
|
||||||
import ./bootstrap-tools/glibc.nix {
|
|
||||||
inherit (stdenv.buildPlatform) system; # Used to determine where to build
|
|
||||||
inherit bootstrapFiles extraAttrs;
|
|
||||||
}
|
|
||||||
else if (stdenv.hostPlatform.libc == "musl") then
|
|
||||||
import ./bootstrap-tools/musl.nix {
|
|
||||||
inherit (stdenv.buildPlatform) system; # Used to determine where to build
|
|
||||||
inherit bootstrapFiles extraAttrs;
|
|
||||||
}
|
|
||||||
else throw "unsupported libc";
|
|
||||||
|
|
||||||
test = pkgs.callPackage ./test-bootstrap-tools.nix {
|
test = pkgs.callPackage ./test-bootstrap-tools.nix {
|
||||||
inherit bootstrapTools;
|
inherit bootstrapTools;
|
||||||
|
Loading…
Reference in New Issue
Block a user