nfs-utils: replace systemd dependency with systemdMinimal (#555251)

This commit is contained in:
Aaron Andersen
2026-08-26 19:52:28 +00:00
committed by GitHub

View File

@@ -15,7 +15,7 @@
libuuid,
keyutils,
lvm2,
systemd,
systemdMinimal,
coreutils,
python3,
buildPackages,
@@ -28,14 +28,19 @@
udevCheckHook,
enablePython ? true,
enableLdap ? true,
enableSystemd ? true,
}:
let
statdPath = lib.makeBinPath [
systemd
util-linux
coreutils
];
statdPath = lib.makeBinPath (
[
util-linux
coreutils
]
++ lib.optionals enableSystemd [
systemdMinimal
]
);
in
stdenv.mkDerivation (finalAttrs: {
@@ -96,11 +101,16 @@ stdenv.mkDerivation (finalAttrs: {
"--enable-svcgss"
"--with-statedir=/var/lib/nfs"
"--with-krb5=${lib.getLib libkrb5}"
"--with-systemd=${placeholder "out"}/etc/systemd/system"
"--enable-libmount-mount"
"--with-pluginpath=${placeholder "lib"}/lib/libnfsidmap" # this installs libnfsidmap
"--with-rpcgen=${buildPackages.rpcsvc-proto}/bin/rpcgen"
"--with-modprobedir=${placeholder "out"}/etc/modprobe.d"
(
if enableSystemd then
"--with-systemd=${placeholder "out"}/etc/systemd/system"
else
"--without-systemd"
)
]
++ lib.optional enableLdap "--enable-ldap";
@@ -139,6 +149,8 @@ stdenv.mkDerivation (finalAttrs: {
makeFlags = [
"sbindir=$(out)/bin"
]
++ lib.optionals enableSystemd [
"generator_dir=$(out)/etc/systemd/system-generators"
];
@@ -153,20 +165,23 @@ stdenv.mkDerivation (finalAttrs: {
"lib"
"libexec"
"bin"
]
++ lib.optionals enableSystemd [
"etc/systemd/system-generators"
];
postInstall = ''
# Not used on NixOS
sed -i \
-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 {}
'';
postInstall =
lib.optionalString enableSystemd ''
# Not used on NixOS
sed -i \
-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.
# doCheck = !stdenv.hostPlatform.isMips;