From 7e2c89d7094aeb67028db639673d2f6211a2184d Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Wed, 7 Jan 2026 12:39:48 -0500 Subject: move solaar rules to udev package --- hosts/shinji/42-logitech-unify-permissions.rules | 31 ---------------------- hosts/shinji/default.nix | 6 ++++- pkgs/default.nix | 1 + .../42-logitech-unify-permissions.rules | 31 ++++++++++++++++++++++ pkgs/solaar-udev-rules/default.nix | 14 ++++++++++ 5 files changed, 51 insertions(+), 32 deletions(-) delete mode 100644 hosts/shinji/42-logitech-unify-permissions.rules create mode 100644 pkgs/solaar-udev-rules/42-logitech-unify-permissions.rules create mode 100644 pkgs/solaar-udev-rules/default.nix diff --git a/hosts/shinji/42-logitech-unify-permissions.rules b/hosts/shinji/42-logitech-unify-permissions.rules deleted file mode 100644 index e52c9b0..0000000 --- a/hosts/shinji/42-logitech-unify-permissions.rules +++ /dev/null @@ -1,31 +0,0 @@ -# This rule was added by Solaar. -# -# Allows non-root users to have raw access to Logitech devices. -# Allowing users to write to the device is potentially dangerous -# because they could perform firmware updates. - -ACTION != "add", GOTO="solaar_end" -SUBSYSTEM != "hidraw", GOTO="solaar_end" - -# USB-connected Logitech receivers and devices -ATTRS{idVendor}=="046d", GOTO="solaar_apply" - -# Lenovo nano receiver -ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="6042", GOTO="solaar_apply" - -# Bluetooth-connected Logitech devices -KERNELS == "0005:046D:*", GOTO="solaar_apply" - -GOTO="solaar_end" - -LABEL="solaar_apply" - -# Allow any seated user to access the receiver. -# uaccess: modern ACL-enabled udev -TAG+="uaccess" - -# Grant members of the "plugdev" group access to receiver (useful for SSH users) -#MODE="0660", GROUP="plugdev" - -LABEL="solaar_end" -# vim: ft=udevrules diff --git a/hosts/shinji/default.nix b/hosts/shinji/default.nix index d502703..c40aba7 100644 --- a/hosts/shinji/default.nix +++ b/hosts/shinji/default.nix @@ -3,6 +3,8 @@ { lib, pkgs, + inputs, + system, ... }: { imports = [ @@ -46,7 +48,9 @@ }; # logitech mouse udev - services.udev.extraRules = lib.fileContents ./42-logitech-unify-permissions.rules; + services.udev.packages = [ + inputs.self.packages.${system}.solaar-udev-rules + ]; # packages environment.systemPackages = with pkgs; [ diff --git a/pkgs/default.nix b/pkgs/default.nix index 1069328..f2bd7c6 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -16,4 +16,5 @@ in { inherit inputs options; }; libfprint-2-tod1-vfs0090 = pkgs.callPackage ./libfprint-2-tod1-vfs0090 {}; + solaar-udev-rules = pkgs.callPackage ./solaar-udev-rules {}; } diff --git a/pkgs/solaar-udev-rules/42-logitech-unify-permissions.rules b/pkgs/solaar-udev-rules/42-logitech-unify-permissions.rules new file mode 100644 index 0000000..e52c9b0 --- /dev/null +++ b/pkgs/solaar-udev-rules/42-logitech-unify-permissions.rules @@ -0,0 +1,31 @@ +# This rule was added by Solaar. +# +# Allows non-root users to have raw access to Logitech devices. +# Allowing users to write to the device is potentially dangerous +# because they could perform firmware updates. + +ACTION != "add", GOTO="solaar_end" +SUBSYSTEM != "hidraw", GOTO="solaar_end" + +# USB-connected Logitech receivers and devices +ATTRS{idVendor}=="046d", GOTO="solaar_apply" + +# Lenovo nano receiver +ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="6042", GOTO="solaar_apply" + +# Bluetooth-connected Logitech devices +KERNELS == "0005:046D:*", GOTO="solaar_apply" + +GOTO="solaar_end" + +LABEL="solaar_apply" + +# Allow any seated user to access the receiver. +# uaccess: modern ACL-enabled udev +TAG+="uaccess" + +# Grant members of the "plugdev" group access to receiver (useful for SSH users) +#MODE="0660", GROUP="plugdev" + +LABEL="solaar_end" +# vim: ft=udevrules diff --git a/pkgs/solaar-udev-rules/default.nix b/pkgs/solaar-udev-rules/default.nix new file mode 100644 index 0000000..a4148a0 --- /dev/null +++ b/pkgs/solaar-udev-rules/default.nix @@ -0,0 +1,14 @@ +{stdenv}: +stdenv.mkDerivation { + name = "solaar-udev-rules"; + + src = ./.; + + dontBuild = true; + dontConfigure = true; + + installPhase = '' + mkdir -p $out/etc/udev/rules.d + cp 42-logitech-unify-permissions.rules $out/etc/udev/rules.d + ''; +} -- cgit v1.2.3-freya