about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorPhilipp Middendorf <middendorf@plapadoo.de>2019-12-22 21:10:48 +0100
committerJan Solanti <jhs@psonet.com>2020-03-30 00:16:21 +0300
commit35035a543c9ed2e3383ecfdf6b9c610e20c3223c (patch)
treeb1d580c9f5eece946f7bab2ab32afccc2439e5f6 /nixos
parent1992768157d7456748ec28e01c8952cf09b53fbf (diff)
downloadnixlib-35035a543c9ed2e3383ecfdf6b9c610e20c3223c.tar
nixlib-35035a543c9ed2e3383ecfdf6b9c610e20c3223c.tar.gz
nixlib-35035a543c9ed2e3383ecfdf6b9c610e20c3223c.tar.bz2
nixlib-35035a543c9ed2e3383ecfdf6b9c610e20c3223c.tar.lz
nixlib-35035a543c9ed2e3383ecfdf6b9c610e20c3223c.tar.xz
nixlib-35035a543c9ed2e3383ecfdf6b9c610e20c3223c.tar.zst
nixlib-35035a543c9ed2e3383ecfdf6b9c610e20c3223c.zip
xow: init at 0.2
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/hardware/uinput.nix19
-rw-r--r--nixos/modules/module-list.nix2
-rw-r--r--nixos/modules/services/hardware/xow.nix30
3 files changed, 51 insertions, 0 deletions
diff --git a/nixos/modules/hardware/uinput.nix b/nixos/modules/hardware/uinput.nix
new file mode 100644
index 000000000000..101c12fe257e
--- /dev/null
+++ b/nixos/modules/hardware/uinput.nix
@@ -0,0 +1,19 @@
+{ config, pkgs, lib, ... }:
+
+let
+  cfg = config.hardware.uinput;
+in {
+  options.hardware.uinput = {
+    enable = lib.mkEnableOption "Whether to enable uinput support";
+  };
+
+  config = lib.mkIf cfg.enable {
+    boot.kernelModules = [ "uinput" ];
+
+    users.groups.uinput = {};
+
+    services.udev.extraRules = ''
+      SUBSYSTEM=="misc", KERNEL=="uinput", MODE="0660", GROUP="uinput", OPTIONS+="static_node=uinput"
+    '';
+  };
+}
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index c2a96c72d165..a3f68207f79f 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -65,6 +65,7 @@
   ./hardware/usb-wwan.nix
   ./hardware/onlykey.nix
   ./hardware/wooting.nix
+  ./hardware/uinput.nix
   ./hardware/video/amdgpu.nix
   ./hardware/video/amdgpu-pro.nix
   ./hardware/video/ati.nix
@@ -368,6 +369,7 @@
   ./services/hardware/thermald.nix
   ./services/hardware/undervolt.nix
   ./services/hardware/vdr.nix
+  ./services/hardware/xow.nix
   ./services/logging/SystemdJournal2Gelf.nix
   ./services/logging/awstats.nix
   ./services/logging/fluentd.nix
diff --git a/nixos/modules/services/hardware/xow.nix b/nixos/modules/services/hardware/xow.nix
new file mode 100644
index 000000000000..a97dd5c870d7
--- /dev/null
+++ b/nixos/modules/services/hardware/xow.nix
@@ -0,0 +1,30 @@
+{ config, pkgs, lib, ... }:
+
+let
+  cfg = config.services.hardware.xow;
+in {
+  options.services.hardware.xow = {
+    enable = lib.mkEnableOption "Whether to enable xow or not.";
+  };
+
+  config = lib.mkIf cfg.enable {
+    hardware.uinput.enable = true;
+
+    users.users.xow = {
+      group = "uinput";
+      isSystemUser = true;
+    };
+
+    systemd.services.xow = {
+      wantedBy = [ "multi-user.target" ];
+      description = "Xbox One Wireless Dongle Driver";
+      after = [ "systemd-udev-settle.service" ];
+      serviceConfig = {
+        ExecStart = ''
+          ${pkgs.xow}/bin/xow
+        '';
+        User = "xow";
+      };
+    };
+  };
+}