From fc004b09e5fbe0affdf4cf7c12cc856dcf214849 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Sun, 10 Dec 2023 11:23:37 -0800 Subject: [PATCH] nixos/ups: install udev rules for nut This is necessary to allow the usbhid driver to successfully send commands to the attached UPS. It is possible to work around this by explicitly using setting the user flag (e.g. `upsdrvctl -u root shutdown`), though it is much simpler to install the udev rules rather than patch things further. --- nixos/modules/services/monitoring/ups.nix | 1 + pkgs/applications/misc/nut/default.nix | 3 +++ 2 files changed, 4 insertions(+) diff --git a/nixos/modules/services/monitoring/ups.nix b/nixos/modules/services/monitoring/ups.nix index c9dda8a8c093..63afb5deb5bd 100644 --- a/nixos/modules/services/monitoring/ups.nix +++ b/nixos/modules/services/monitoring/ups.nix @@ -590,6 +590,7 @@ in "d /var/lib/nut 700" ]; + services.udev.packages = [ pkgs.nut ]; /* users.users.nut = diff --git a/pkgs/applications/misc/nut/default.nix b/pkgs/applications/misc/nut/default.nix index 85fe7afdaaf2..2f3be342a7a8 100644 --- a/pkgs/applications/misc/nut/default.nix +++ b/pkgs/applications/misc/nut/default.nix @@ -85,6 +85,9 @@ stdenv.mkDerivation rec { # we don't need init.d scripts rm -r $out/share/solaris-init + + # Suspicious/overly broad rule, remove it until we know better + rm $out/etc/udev/rules.d/52-nut-ipmipsu.rules ''; meta = with lib; {