diff options
author | Michele Guerini Rocco <rnhmjoj@users.noreply.github.com> | 2023-06-07 10:22:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-07 10:22:18 +0200 |
commit | e9da2bac9606619825941fcc4a011a17ee9f5324 (patch) | |
tree | 3363d43de862935936e072e5de4b37295583db4c /nixos | |
parent | 8b56171f6c306e32ae2120dcc534f8d31645f457 (diff) | |
parent | b4e5de4ba4666951e501a01e1d1483531ce32009 (diff) |
Merge pull request #236048 from rnhmjoj/pr-fix-i2c
nixos/hardware/i2c: fix uaccess rule
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/hardware/i2c.nix | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nixos/modules/hardware/i2c.nix b/nixos/modules/hardware/i2c.nix index c0423cc5d997..9a5a2e44813e 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"; + }); }; |