diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2017-05-25 00:01:07 +0200 |
---|---|---|
committer | Franz Pletz <fpletz@fnordicwalking.de> | 2017-05-26 00:47:46 +0200 |
commit | 839647e630474aeb172540df4305a26a70343766 (patch) | |
tree | 0623a217b09aaad4554139ca21f0fc9055e6f7a0 | |
parent | 5e4a797888e0612f00a0509918d1d9aaa5219d9d (diff) |
nitrokey module: init
-rw-r--r-- | nixos/modules/hardware/nitrokey.nix | 41 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 |
2 files changed, 42 insertions, 0 deletions
diff --git a/nixos/modules/hardware/nitrokey.nix b/nixos/modules/hardware/nitrokey.nix new file mode 100644 index 0000000000000..bd440de697228 --- /dev/null +++ b/nixos/modules/hardware/nitrokey.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.hardware.nitrokey; + +in + +{ + options.hardware.nitrokey = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Enables udev rules for Nitrokey devices. By default grants access + to users in the "nitrokey" group. You may want to install the + nitrokey-app package, depending on your device and needs. + ''; + }; + + group = mkOption { + type = types.str; + default = "nitrokey"; + example = "wheel"; + description = '' + Grant access to Nitrokey devices to users in this group. + ''; + }; + }; + + config = mkIf cfg.enable { + services.udev.packages = [ + (pkgs.nitrokey-udev-rules.override (attrs: + { inherit (cfg) group; } + )) + ]; + users.extraGroups."${cfg.group}" = {}; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index a3405c069b34c..1bd9001b5540e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -39,6 +39,7 @@ ./hardware/network/intel-3945abg.nix ./hardware/network/ralink.nix ./hardware/network/rtl8192c.nix + ./hardware/nitrokey.nix ./hardware/opengl.nix ./hardware/pcmcia.nix ./hardware/usb-wwan.nix |