diff options
author | Emily Trau <emily@downunderctf.com> | 2023-07-22 21:51:08 -0700 |
---|---|---|
committer | Emily Trau <emily@downunderctf.com> | 2023-07-22 21:51:39 -0700 |
commit | 3c850627a608e387aed1fbc3884b41ac66cb5e99 (patch) | |
tree | 8fd9fda326941e439f5a03e5b71310461f116f01 /pkgs/os-specific/linux/minimal-bootstrap | |
parent | 9811c08c162a19658221ae58c42f578a85fd71d0 (diff) | |
download | nixlib-3c850627a608e387aed1fbc3884b41ac66cb5e99.tar nixlib-3c850627a608e387aed1fbc3884b41ac66cb5e99.tar.gz nixlib-3c850627a608e387aed1fbc3884b41ac66cb5e99.tar.bz2 nixlib-3c850627a608e387aed1fbc3884b41ac66cb5e99.tar.lz nixlib-3c850627a608e387aed1fbc3884b41ac66cb5e99.tar.xz nixlib-3c850627a608e387aed1fbc3884b41ac66cb5e99.tar.zst nixlib-3c850627a608e387aed1fbc3884b41ac66cb5e99.zip |
minimal-bootstrap.bash: init at 5.2.15
Diffstat (limited to 'pkgs/os-specific/linux/minimal-bootstrap')
-rw-r--r-- | pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix | 98 | ||||
-rw-r--r-- | pkgs/os-specific/linux/minimal-bootstrap/default.nix | 7 |
2 files changed, 105 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix new file mode 100644 index 000000000000..9c9682fdf9d5 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix @@ -0,0 +1,98 @@ +{ lib +, buildPlatform +, hostPlatform +, fetchurl +, bootBash +, gnumake +, gnused +, gnugrep +, gnutar +, gawk +, gzip +, gcc +, glibc +, binutils +, linux-headers +, derivationWithMeta +, bash +, coreutils +}: +let + pname = "bash"; + version = "5.2.15"; + + src = fetchurl { + url = "mirror://gnu/bash/bash-${version}.tar.gz"; + sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk"; + }; +in +bootBash.runCommand "${pname}-${version}" { + inherit pname version; + + nativeBuildInputs = [ + gcc + binutils + gnumake + gnused + gnugrep + gnutar + gawk + gzip + ]; + + passthru.runCommand = name: env: buildCommand: + derivationWithMeta ({ + inherit name buildCommand; + builder = "${bash}/bin/bash"; + args = [ + "-e" + (builtins.toFile "bash-builder.sh" '' + export CONFIG_SHELL=$SHELL + bash -eux $buildCommandPath + '') + ]; + passAsFile = [ "buildCommand" ]; + + SHELL = "${bash}/bin/bash"; + PATH = lib.makeBinPath ((env.nativeBuildInputs or []) ++ [ + bash + coreutils + ]); + } // (builtins.removeAttrs env [ "nativeBuildInputs" ])); + + passthru.tests.get-version = result: + bootBash.runCommand "${pname}-get-version-${version}" {} '' + ${result}/bin/bash --version + mkdir $out + ''; + + meta = with lib; { + description = "GNU Bourne-Again Shell, the de facto standard shell on Linux"; + homepage = "https://www.gnu.org/software/bash"; + license = licenses.gpl3Plus; + maintainers = teams.minimal-bootstrap.members; + platforms = platforms.unix; + }; +} '' + # Unpack + tar xzf ${src} + cd bash-${version} + + # Configure + export CC="gcc -I${glibc}/include -I${linux-headers}/include" + export LIBRARY_PATH="${glibc}/lib" + export LIBS="-lc -lnss_files -lnss_dns -lresolv" + export ac_cv_func_dlopen=no + bash ./configure \ + --prefix=$out \ + --build=${buildPlatform.config} \ + --host=${hostPlatform.config} \ + --disable-nls \ + --disable-net-redirections + + # Build + make SHELL=bash + + # Install + make install +'' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index ca22c4898f91..5dd0860ac1f9 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -15,6 +15,12 @@ lib.makeScope bash_2_05 = callPackage ./bash/2.nix { tinycc = tinycc-mes; }; + bash = callPackage ./bash { + bootBash = bash_2_05; + gcc = gcc2; + glibc = glibc22; + }; + binutils = callPackage ./binutils { bash = bash_2_05; gcc = gcc2; @@ -123,6 +129,7 @@ lib.makeScope inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText; test = kaem.runCommand "minimal-bootstrap-test" {} '' + echo ${bash.tests.get-version} echo ${bash_2_05.tests.get-version} echo ${binutils.tests.get-version} echo ${binutils-mes.tests.get-version} |