{ lib, buildPlatform, hostPlatform, fetchurl, bash, gcc, binutils, gnumake, gnused, gnugrep, gawk, diffutils, findutils, gnutar, xz, }: let pname = "gnupatch-static"; version = "2.8"; src = fetchurl { url = "mirror://gnu/patch/patch-${version}.tar.xz"; hash = "sha256-+Hzuae7CtPy/YKOWsDCtaqNBXxkqpffuhMrV4R9/WuM="; }; in bash.runCommand "${pname}-${version}" { inherit pname version; nativeBuildInputs = [ gcc binutils gnumake gnused gnugrep gawk diffutils findutils gnutar xz ]; passthru.tests.get-version = result: bash.runCommand "${pname}-get-version-${version}" { } '' ${result}/bin/patch --version mkdir $out ''; meta = { description = "GNU Patch, a program to apply differences to files"; homepage = "https://www.gnu.org/software/patch"; license = lib.licenses.gpl3Plus; mainProgram = "patch"; platforms = lib.platforms.unix; teams = [ lib.teams.minimal-bootstrap ]; }; } '' # Unpack tar xf ${src} cd patch-${version} # Configure bash ./configure \ --prefix=$out \ --build=${buildPlatform.config} \ --host=${hostPlatform.config} \ --disable-dependency-tracking # Build make -j $NIX_BUILD_CORES # Install make -j $NIX_BUILD_CORES install-strip rm -rf $out/share ''