nfs-utils: Add enablePython argument

If turned off, all binaries that need python are excluded

With the argument disabled, this reduces closure size from 219.5M to
160.3M
This commit is contained in:
Silvan Mosberger 2020-04-02 20:56:42 +02:00
parent f75c11cfdf
commit 848ed261f5
No known key found for this signature in database
GPG key ID: E8F1E9EAD284E17D

View file

@ -1,6 +1,7 @@
{ stdenv, fetchurl, fetchpatch, lib, pkgconfig, utillinux, libcap, libtirpc, libevent
, sqlite, kerberos, kmod, libuuid, keyutils, lvm2, systemd, coreutils, tcp_wrappers
, python3, buildPackages, nixosTests
, enablePython ? true
}:
let
@ -25,8 +26,7 @@ stdenv.mkDerivation rec {
buildInputs = [
libtirpc libcap libevent sqlite lvm2
libuuid keyutils kerberos tcp_wrappers
python3
];
] ++ lib.optional enablePython python3;
enableParallelBuilding = true;
@ -96,6 +96,9 @@ stdenv.mkDerivation rec {
-e "s,/sbin/modprobe,${kmod}/bin/modprobe,g" \
-e "s,/usr/sbin,$out/bin,g" \
$out/etc/systemd/system/*
'' + lib.optionalString (!enablePython) ''
# Remove all scripts that require python (currently mountstats and nfsiostat)
grep -l /usr/bin/python $out/bin/* | xargs -I {} rm -v {}
'';
# One test fails on mips.