mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-20 11:05:14 +00:00
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, ...).
|
||||
bootstrapTools = (import (if localSystem.libc == "musl" then ./bootstrap-tools/musl.nix else ./bootstrap-tools/glibc.nix) {
|
||||
inherit system bootstrapFiles;
|
||||
extraAttrs = lib.optionalAttrs config.contentAddressedByDefault {
|
||||
__contentAddressed = true;
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
};
|
||||
}) // { passthru.isFromBootstrapFiles = true; };
|
||||
bootstrapTools = import ./bootstrap-tools {
|
||||
inherit (localSystem) libc system;
|
||||
inherit lib bootstrapFiles config;
|
||||
isFromBootstrapFiles = true;
|
||||
};
|
||||
|
||||
getLibc = stage: stage.${localSystem.libc};
|
||||
|
||||
|
@ -49,26 +49,11 @@ rec {
|
||||
|
||||
inherit (build) bootstrapFiles;
|
||||
|
||||
bootstrapTools =
|
||||
let extraAttrs = lib.optionalAttrs
|
||||
config.contentAddressedByDefault
|
||||
{
|
||||
__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";
|
||||
bootstrapTools = import ./bootstrap-tools {
|
||||
inherit (stdenv.buildPlatform) system; # Used to determine where to build
|
||||
inherit (stdenv.hostPlatform) libc;
|
||||
inherit lib bootstrapFiles config;
|
||||
};
|
||||
|
||||
test = pkgs.callPackage ./test-bootstrap-tools.nix {
|
||||
inherit bootstrapTools;
|
||||
|
Loading…
Reference in New Issue
Block a user