Skip to content

Commit ba00c29

Browse files
authored
nixos/sane: ensure saned can access usb scanners (#367198)
2 parents 3f4d074 + 7d0c25d commit ba00c29

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

nixos/modules/services/hardware/sane.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ in
184184
environment.etc."sane-config".source = config.hardware.sane.configDir;
185185
environment.etc."sane-libs".source = "${saneConfig}/lib/sane";
186186
services.udev.packages = backends;
187+
# sane sets up udev rules that tag scanners with `uaccess`. This way, physically logged in users
188+
# can access them without belonging to the `scanner` group. However, the `scanner` user used by saned
189+
# does not have a real logind seat, so `uaccess` is not enough.
190+
services.udev.extraRules = ''
191+
ENV{DEVNAME}!="", ENV{libsane_matched}=="yes", RUN+="${pkgs.acl}/bin/setfacl -m g:scanner:rw $env{DEVNAME}"
192+
'';
187193

188194
users.groups.scanner.gid = config.ids.gids.scanner;
189195
networking.firewall.allowedUDPPorts = lib.mkIf config.hardware.sane.openFirewall [ 8612 ];

0 commit comments

Comments
 (0)