about summary refs log tree commit diff
path: root/nixos/modules/services/hardware
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2023-10-14 18:48:31 -0700
committerRobert Schütz <nix@dotlambda.de>2023-10-14 18:52:38 -0700
commit04b6bd2def3b3062a09cdc617bebdc4ff923efb1 (patch)
tree314dc75256d48526ee8214bbdaaa9e98585566d3 /nixos/modules/services/hardware
parente89936d319df9b72aa027834062a4efb12d50fa0 (diff)
downloadnixlib-04b6bd2def3b3062a09cdc617bebdc4ff923efb1.tar
nixlib-04b6bd2def3b3062a09cdc617bebdc4ff923efb1.tar.gz
nixlib-04b6bd2def3b3062a09cdc617bebdc4ff923efb1.tar.bz2
nixlib-04b6bd2def3b3062a09cdc617bebdc4ff923efb1.tar.lz
nixlib-04b6bd2def3b3062a09cdc617bebdc4ff923efb1.tar.xz
nixlib-04b6bd2def3b3062a09cdc617bebdc4ff923efb1.tar.zst
nixlib-04b6bd2def3b3062a09cdc617bebdc4ff923efb1.zip
nixos/iptsd: init
Diffstat (limited to 'nixos/modules/services/hardware')
-rw-r--r--nixos/modules/services/hardware/iptsd.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/nixos/modules/services/hardware/iptsd.nix b/nixos/modules/services/hardware/iptsd.nix
new file mode 100644
index 000000000000..8af0a6d6bbe1
--- /dev/null
+++ b/nixos/modules/services/hardware/iptsd.nix
@@ -0,0 +1,53 @@
+{ config, lib, pkgs, ... }:
+
+let
+  cfg = config.services.iptsd;
+  format = pkgs.formats.ini { };
+  configFile = format.generate "iptsd.conf" cfg.config;
+in {
+  options.services.iptsd = {
+    enable = lib.mkEnableOption (lib.mdDoc "the userspace daemon for Intel Precise Touch & Stylus");
+
+    config = lib.mkOption {
+      default = { };
+      description = lib.mdDoc ''
+        Configuration for IPTSD. See the
+        [reference configuration](https://github.com/linux-surface/iptsd/blob/master/etc/iptsd.conf)
+        for available options and defaults.
+      '';
+      type = lib.types.submodule {
+        freeformType = format.type;
+        options = {
+          Touch = {
+            DisableOnPalm = lib.mkOption {
+              default = false;
+              description = lib.mdDoc "Ignore all touch inputs if a palm was registered on the display.";
+              type = lib.types.bool;
+            };
+            DisableOnStylus = lib.mkOption {
+              default = false;
+              description = lib.mdDoc "Ignore all touch inputs if a stylus is in proximity.";
+              type = lib.types.bool;
+            };
+          };
+          Stylus = {
+            Disable = lib.mkOption {
+              default = false;
+              description = lib.mdDoc "Disables the stylus. No stylus data will be processed.";
+              type = lib.types.bool;
+            };
+          };
+        };
+      };
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    systemd.packages = [ pkgs.iptsd ];
+    environment.etc."iptsd.conf".source = configFile;
+    systemd.services."iptsd@".restartTriggers = [ configFile ];
+    services.udev.packages = [ pkgs.iptsd ];
+  };
+
+  meta.maintainers = with lib.maintainers; [ dotlambda ];
+}