at 18.09-beta 855 B view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 cfg = config.hardware.nitrokey; 8 9in 10 11{ 12 options.hardware.nitrokey = { 13 enable = mkOption { 14 type = types.bool; 15 default = false; 16 description = '' 17 Enables udev rules for Nitrokey devices. By default grants access 18 to users in the "nitrokey" group. You may want to install the 19 nitrokey-app package, depending on your device and needs. 20 ''; 21 }; 22 23 group = mkOption { 24 type = types.str; 25 default = "nitrokey"; 26 example = "wheel"; 27 description = '' 28 Grant access to Nitrokey devices to users in this group. 29 ''; 30 }; 31 }; 32 33 config = mkIf cfg.enable { 34 services.udev.packages = [ 35 (pkgs.nitrokey-udev-rules.override (attrs: 36 { inherit (cfg) group; } 37 )) 38 ]; 39 users.groups."${cfg.group}" = {}; 40 }; 41}