From f686de766b7ef4eb1162213755c5f5c615bf023f Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Fri, 21 Aug 2026 19:54:23 -0400 Subject: [PATCH 1/2] nfs-utils: replace systemd dependency with systemdMinimal --- pkgs/by-name/nf/nfs-utils/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/nf/nfs-utils/package.nix b/pkgs/by-name/nf/nfs-utils/package.nix index b53ea79bb39d..472b345bec6d 100644 --- a/pkgs/by-name/nf/nfs-utils/package.nix +++ b/pkgs/by-name/nf/nfs-utils/package.nix @@ -15,7 +15,7 @@ libuuid, keyutils, lvm2, - systemd, + systemdMinimal, coreutils, python3, buildPackages, @@ -32,7 +32,7 @@ let statdPath = lib.makeBinPath [ - systemd + systemdMinimal util-linux coreutils ]; From 7b2ce2b21c35abaaedf2a11a111f0edcbeeac256 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Fri, 21 Aug 2026 19:55:09 -0400 Subject: [PATCH 2/2] nfs-utils: make systemd dependency optional --- pkgs/by-name/nf/nfs-utils/package.nix | 49 +++++++++++++++++---------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/nf/nfs-utils/package.nix b/pkgs/by-name/nf/nfs-utils/package.nix index 472b345bec6d..ebb24838f19b 100644 --- a/pkgs/by-name/nf/nfs-utils/package.nix +++ b/pkgs/by-name/nf/nfs-utils/package.nix @@ -28,14 +28,19 @@ udevCheckHook, enablePython ? true, enableLdap ? true, + enableSystemd ? true, }: let - statdPath = lib.makeBinPath [ - systemdMinimal - 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;