aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/hardware/nitrokey.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/hardware/nitrokey.nix')
-rw-r--r--nixpkgs/nixos/modules/hardware/nitrokey.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/hardware/nitrokey.nix b/nixpkgs/nixos/modules/hardware/nitrokey.nix
new file mode 100644
index 00000000000..02e4c3f46f8
--- /dev/null
+++ b/nixpkgs/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.groups.${cfg.group} = {};
+ };
+}