vpnc-scripts: only reference systemd when available

This fixes e.g. static builds, where systemd is unsupported.
This commit is contained in:
Alyssa Ross 2025-06-01 14:44:10 +02:00
parent 06892faa1a
commit 5ca7d9a48b

View file

@ -10,6 +10,7 @@
nettools,
openresolv,
systemd,
withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
}:
stdenv.mkDerivation {
@ -36,7 +37,10 @@ stdenv.mkDerivation {
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace $out/bin/vpnc-script \
--replace "/sbin/resolvconf" "${openresolv}/bin/resolvconf" \
--replace "/sbin/resolvconf" "${openresolv}/bin/resolvconf"
''
+ lib.optionalString withSystemd ''
substituteInPlace $out/bin/vpnc-script \
--replace "/usr/bin/resolvectl" "${systemd}/bin/resolvectl"
''
+ ''