24 url = "mirror://gnu/bash/bash-${version}.tar.gz";
25 sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
29 # flush output for generated code
30 ./mksignames-flush.patch
33 bootBash.runCommand "${pname}-${version}" {
34 inherit pname version;
49 passthru.runCommand = name: env: buildCommand:
51 inherit name buildCommand;
52 builder = "${bash}/bin/bash";
55 (builtins.toFile "bash-builder.sh" ''
56 export CONFIG_SHELL=$SHELL
58 # Normalize the NIX_BUILD_CORES variable. The value might be 0, which
59 # means that we're supposed to try and auto-detect the number of
60 # available CPU cores at run-time.
61 NIX_BUILD_CORES="''${NIX_BUILD_CORES:-1}"
62 if ((NIX_BUILD_CORES <= 0)); then
63 guess=$(nproc 2>/dev/null || true)
64 ((NIX_BUILD_CORES = guess <= 0 ? 1 : guess))
66 export NIX_BUILD_CORES
68 bash -eux $buildCommandPath
71 passAsFile = [ "buildCommand" ];
73 SHELL = "${bash}/bin/bash";
74 PATH = lib.makeBinPath ((env.nativeBuildInputs or []) ++ [
78 } // (builtins.removeAttrs env [ "nativeBuildInputs" ]));
80 passthru.tests.get-version = result:
81 bootBash.runCommand "${pname}-get-version-${version}" {} ''
82 ${result}/bin/bash --version
87 description = "GNU Bourne-Again Shell, the de facto standard shell on Linux";
88 homepage = "https://www.gnu.org/software/bash";
89 license = licenses.gpl3Plus;
90 maintainers = teams.minimal-bootstrap.members;
91 platforms = platforms.unix;
99 ${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
102 export CC="tcc -B ${tinycc.libs}/lib"
107 --build=${buildPlatform.config} \
108 --host=${hostPlatform.config} \
109 --without-bash-malloc
112 make -j $NIX_BUILD_CORES SHELL=bash
115 make -j $NIX_BUILD_CORES install
116 ln -s bash $out/bin/sh