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 /nixos/modules/hardware/nitrokey.nix | |
parent | 5e4a797888e0612f00a0509918d1d9aaa5219d9d (diff) | |
download | nixpkgs-839647e630474aeb172540df4305a26a70343766.tar nixpkgs-839647e630474aeb172540df4305a26a70343766.tar.gz nixpkgs-839647e630474aeb172540df4305a26a70343766.tar.bz2 nixpkgs-839647e630474aeb172540df4305a26a70343766.tar.lz nixpkgs-839647e630474aeb172540df4305a26a70343766.tar.xz nixpkgs-839647e630474aeb172540df4305a26a70343766.tar.zst nixpkgs-839647e630474aeb172540df4305a26a70343766.zip |
nitrokey module: init
Diffstat (limited to 'nixos/modules/hardware/nitrokey.nix')
-rw-r--r-- | nixos/modules/hardware/nitrokey.nix | 41 |
1 files changed, 41 insertions, 0 deletions
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}" = {}; + }; +} |