git.iko.soy/typeable/nixpkgs
on master help sign in
nitrokey module: init
commit839647e630474aeb172540df4305a26a70343766 authorFranz Pletz <fpletz@fnordicwalking.de> dateThu 25 May 2017, 00:01 (10 years ago) parent5e4a797
2 files changed+42
nixos/modules/hardware/nitrokey.nix+41 nixos/modules/module-list.nix+1
nixos/modules/hardware/nitrokey.nixnew file+41
@@ -0,0 +1,41 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+
7+ cfg = config.hardware.nitrokey;
8+
9+in
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.extraGroups."${cfg.group}" = {};
40+ };
41+}
nixos/modules/module-list.nix+1
@@ -39,6 +39,7 @@
3939 ./hardware/network/intel-3945abg.nix
4040 ./hardware/network/ralink.nix
4141 ./hardware/network/rtl8192c.nix
42+ ./hardware/nitrokey.nix
4243 ./hardware/opengl.nix
4344 ./hardware/pcmcia.nix
4445 ./hardware/usb-wwan.nix