summary refs log tree commit diff
path: root/nixos/modules/hardware/i2c.nix
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2023-06-04 21:22:32 +0200
committerrnhmjoj <rnhmjoj@inventati.org>2023-06-04 21:22:32 +0200
commitb4e5de4ba4666951e501a01e1d1483531ce32009 (patch)
tree997f2115d118210f513c03ba2e4d36ec04ae1cfb /nixos/modules/hardware/i2c.nix
parent1a14c8d6b157e2402695db4e5a05bd3f5c90a16c (diff)
downloadnixpkgs-b4e5de4ba4666951e501a01e1d1483531ce32009.tar
nixpkgs-b4e5de4ba4666951e501a01e1d1483531ce32009.tar.gz
nixpkgs-b4e5de4ba4666951e501a01e1d1483531ce32009.tar.bz2
nixpkgs-b4e5de4ba4666951e501a01e1d1483531ce32009.tar.lz
nixpkgs-b4e5de4ba4666951e501a01e1d1483531ce32009.tar.xz
nixpkgs-b4e5de4ba4666951e501a01e1d1483531ce32009.tar.zst
nixpkgs-b4e5de4ba4666951e501a01e1d1483531ce32009.zip
nixos/hardware/i2c: fix uaccess rule
Diffstat (limited to 'nixos/modules/hardware/i2c.nix')
-rw-r--r--nixos/modules/hardware/i2c.nix14
1 files changed, 9 insertions, 5 deletions
diff --git a/nixos/modules/hardware/i2c.nix b/nixos/modules/hardware/i2c.nix
index c0423cc5d99..9a5a2e44813 100644
--- a/nixos/modules/hardware/i2c.nix
+++ b/nixos/modules/hardware/i2c.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ config, lib, pkgs, ... }:
 
 with lib;
 
@@ -31,10 +31,14 @@ in
       i2c = { };
     };
 
-    services.udev.extraRules = ''
-      # allow group ${cfg.group} and users with a seat use of i2c devices
-      ACTION=="add", KERNEL=="i2c-[0-9]*", TAG+="uaccess", GROUP="${cfg.group}", MODE="660"
-    '';
+    services.udev.packages = lib.singleton (pkgs.writeTextFile
+      { name = "i2c-udev-rules";
+        text = ''
+          # allow group ${cfg.group} and users with a seat use of i2c devices
+          ACTION=="add", KERNEL=="i2c-[0-9]*", TAG+="uaccess", GROUP="${cfg.group}", MODE="660"
+        '';
+        destination = "/etc/udev/rules.d/70-i2c.rules";
+      });
 
   };