about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorRobert Gerus <ar@is-a.cat>2023-09-20 21:29:56 +0200
committerAustin Seipp <aseipp@pobox.com>2023-09-21 11:48:01 -0500
commit294c4ec95607b82b10ccb79eaeedf865fb258091 (patch)
tree815353a1a34ffec2c356b3c96f06328cf9cefa2a /nixos
parentc05123ba4ae325d64dcebdd8ab1888d6397eb590 (diff)
downloadnixlib-294c4ec95607b82b10ccb79eaeedf865fb258091.tar
nixlib-294c4ec95607b82b10ccb79eaeedf865fb258091.tar.gz
nixlib-294c4ec95607b82b10ccb79eaeedf865fb258091.tar.bz2
nixlib-294c4ec95607b82b10ccb79eaeedf865fb258091.tar.lz
nixlib-294c4ec95607b82b10ccb79eaeedf865fb258091.tar.xz
nixlib-294c4ec95607b82b10ccb79eaeedf865fb258091.tar.zst
nixlib-294c4ec95607b82b10ccb79eaeedf865fb258091.zip
nixos/glasgow: init hardware module
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/hardware/glasgow.nix23
-rw-r--r--nixos/modules/module-list.nix1
2 files changed, 24 insertions, 0 deletions
diff --git a/nixos/modules/hardware/glasgow.nix b/nixos/modules/hardware/glasgow.nix
new file mode 100644
index 000000000000..f8ebb772c47b
--- /dev/null
+++ b/nixos/modules/hardware/glasgow.nix
@@ -0,0 +1,23 @@
+{ config, lib, pkgs, ... }:
+
+let
+  cfg = config.hardware.glasgow;
+
+in
+{
+  options.hardware.glasgow = {
+    enable = lib.mkOption {
+      type = lib.types.bool;
+      default = false;
+      description = lib.mdDoc ''
+        Enables Glasgow udev rules and ensures 'plugdev' group exists.
+        This is a prerequisite to using Glasgow without being root.
+      '';
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    services.udev.packages = [ pkgs.glasgow ];
+    users.groups.plugdev = { };
+  };
+}
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 811a46563fb4..e17d430e59b6 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -61,6 +61,7 @@
   ./hardware/flipperzero.nix
   ./hardware/flirc.nix
   ./hardware/gkraken.nix
+  ./hardware/glasgow.nix
   ./hardware/gpgsmartcards.nix
   ./hardware/hackrf.nix
   ./hardware/i2c.nix