nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/findutils/static.nix
Aliaksandr 3a2649965b
minimal-bootstrap: trim findutils-static output
Disable NLS and keep only the bootstrap-relevant find and xargs tools. Drop locate, updatedb, frcode, documentation, locale data, and the var directory.

Size impact against upstream/staging:

- findutils-static closure: 2.830 MiB -> 0.592 MiB (-2.237 MiB)

Assisted-by: codex with gpt-5.5-high
2026-06-08 00:09:37 +03:00

86 lines
1.7 KiB
Nix

{
lib,
buildPlatform,
hostPlatform,
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
gnugrep,
gawk,
diffutils,
findutils,
gnutar,
xz,
}:
let
pname = "findutils-static";
version = "4.10.0";
src = fetchurl {
url = "mirror://gnu/findutils/findutils-${version}.tar.xz";
hash = "sha256-E4fgtn/yR9Kr3pmPkN+/cMFJE5Glnd/suK5ph4nwpPU=";
};
in
bash.runCommand "${pname}-${version}"
{
inherit pname version;
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
gnugrep
gawk
diffutils
findutils
gnutar
xz
];
passthru.tests.get-version =
result:
bash.runCommand "${pname}-get-version-${version}" { } ''
${result}/bin/find --version
${result}/bin/xargs --version
mkdir $out
'';
meta = {
description = "GNU Find Utilities, the basic directory searching utilities of the GNU operating system";
homepage = "https://www.gnu.org/software/findutils";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.unix;
teams = [ lib.teams.minimal-bootstrap ];
};
}
''
# Unpack
tar xf ${src}
cd findutils-${version}
# Configure
bash ./configure \
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
--disable-nls \
CC=musl-gcc \
CFLAGS=-static
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install-strip
# Keep only the bootstrap-relevant find/xargs tools.
rm -f $out/bin/locate $out/bin/updatedb
rm -rf $out/libexec $out/share $out/var
''