diff options
author | Ivan Petkov <ivanppetkov@gmail.com> | 2023-12-10 10:57:50 -0800 |
---|---|---|
committer | Ivan Petkov <ivanppetkov@gmail.com> | 2023-12-10 10:57:50 -0800 |
commit | 4a219c8aebf8275118981db856355f88aaa84bca (patch) | |
tree | 80f4a222629d9f2e4f943e07c7ee72fb31fb3591 | |
parent | 610a958b03fb660c282148b2a6e15d2f5e20b47a (diff) |
nut: patch nutshutdown to set a default for NUT_CONFPATH
The way we build the package results in the binaries being hardcoded to look for $out/etc/ups.conf instead of /etc/nut/ups.conf (where the module places the file). This results in `upsdrvctl` failing to dispatch shutdown commands (since it cannot find the configuration) and prevents a primary monitor from cutting power to the appropriate UPS. Note that we cannot use `--sysconfdir=/etc/nut` as a configure flag since that results in the install phase trying to install directly into /etc/nut which predictably fails in the sandbox.
-rw-r--r-- | pkgs/applications/misc/nut/default.nix | 7 | ||||
-rw-r--r-- | pkgs/applications/misc/nut/nutshutdown-conf-default.patch | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/applications/misc/nut/default.nix b/pkgs/applications/misc/nut/default.nix index 5596fc6010ecc..9436b14e51384 100644 --- a/pkgs/applications/misc/nut/default.nix +++ b/pkgs/applications/misc/nut/default.nix @@ -30,6 +30,13 @@ stdenv.mkDerivation rec { }; patches = [ + # This patch injects a default value for NUT_CONFPATH into the nutshutdown script + # since the way we build the package results in the binaries being hardcoded to check + # $out/etc/ups.conf instead of /etc/nut/ups.conf (where the module places the file). + # We also cannot use `--sysconfdir=/etc/nut` since that results in the install phase + # trying to install directly into /etc/nut which predictably fails + ./nutshutdown-conf-default.patch + (substituteAll { src = ./hardcode-paths.patch; avahi = "${avahi}/lib"; diff --git a/pkgs/applications/misc/nut/nutshutdown-conf-default.patch b/pkgs/applications/misc/nut/nutshutdown-conf-default.patch new file mode 100644 index 0000000000000..28e5a286126dd --- /dev/null +++ b/pkgs/applications/misc/nut/nutshutdown-conf-default.patch @@ -0,0 +1,10 @@ +diff --git a/scripts/systemd/nutshutdown.in b/scripts/systemd/nutshutdown.in +index ace2485b3..9dee869bb 100755 +--- a/scripts/systemd/nutshutdown.in ++++ b/scripts/systemd/nutshutdown.in +@@ -1,4 +1,5 @@ + #!/bin/sh ++export NUT_CONFPATH="${NUT_CONFPATH-/etc/nut}" + + # This script requires both nut-server (drivers) + # and nut-client (upsmon) to be present locally |