Unverified Commit 7d995675 authored by Ivan Petkov's avatar Ivan Petkov
Browse files

nut: fix systemd unit patching

The NixOS module will create a file in /etc/nut/nut.conf (not in
/etc/nut.conf) so the systemd units should be patched accordingly.
parent 4a219c8a
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
, substituteAll
, systemd
, udev
, gnused
}:

stdenv.mkDerivation rec {
@@ -70,14 +71,18 @@ stdenv.mkDerivation rec {

  postInstall = ''
    substituteInPlace $out/lib/systemd/system-shutdown/nutshutdown \
      --replace /bin/sed "${gnused}/bin/sed" \
      --replace /bin/sleep "${coreutils}/bin/sleep" \
      --replace /bin/systemctl "${systemd}/bin/systemctl"

    for file in system/{nut-monitor.service,nut-driver-enumerator.service,nut-server.service,nut-driver@.service} system-shutdown/nutshutdown; do
      substituteInPlace $out/lib/systemd/$file \
      --replace "$out/etc/nut.conf" "/etc/nut.conf"
        --replace "$out/etc/nut.conf" "/etc/nut/nut.conf"
    done

    substituteInPlace $out/lib/systemd/system/nut-driver-enumerator.path \
      --replace "$out/etc/ups.conf" "/etc/nut/ups.conf"

    # we don't need init.d scripts
    rm -r $out/share/solaris-init
  '';