From 839647e630474aeb172540df4305a26a70343766 Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Thu, 25 May 2017 00:01:07 +0200 Subject: [PATCH] nitrokey module: init --- nixos/modules/hardware/nitrokey.nix | 41 +++++++++++++++++++++++++++++ nixos/modules/module-list.nix | 1 + 2 files changed, 42 insertions(+) create mode 100644 nixos/modules/hardware/nitrokey.nix diff --git a/nixos/modules/hardware/nitrokey.nix b/nixos/modules/hardware/nitrokey.nix new file mode 100644 index 00000000000..bd440de6972 --- /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 a3405c069b3..1bd9001b554 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