From 791ef2e848cdb2e99f2eae43923856b19bb14e8e Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Sun, 27 Dec 2020 18:29:25 -0300 Subject: nixos/hardware: add opentabletdriver module --- nixos/modules/hardware/opentabletdriver.nix | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 nixos/modules/hardware/opentabletdriver.nix (limited to 'nixos/modules/hardware/opentabletdriver.nix') diff --git a/nixos/modules/hardware/opentabletdriver.nix b/nixos/modules/hardware/opentabletdriver.nix new file mode 100644 index 00000000000..b759bcf034e --- /dev/null +++ b/nixos/modules/hardware/opentabletdriver.nix @@ -0,0 +1,58 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.hardware.opentabletdriver; +in +{ + options = { + hardware.opentabletdriver = { + enable = mkOption { + default = false; + type = types.bool; + description = '' + Enable OpenTabletDriver udev rules, user service and blacklist kernel + modules known to conflict with OpenTabletDriver. + ''; + }; + + blacklistedKernelModules = mkOption { + type = types.listOf types.str; + default = [ "hid-uclogic" "wacom" ]; + description = '' + Blacklist of kernel modules known to conflict with OpenTabletDriver. + ''; + }; + + daemon = { + enable = mkOption { + default = true; + type = types.bool; + description = '' + Whether to start OpenTabletDriver daemon as a systemd user service. + ''; + }; + }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ opentabletdriver ]; + + services.udev.packages = with pkgs; [ opentabletdriver ]; + + boot.blacklistedKernelModules = cfg.blacklistedKernelModules; + + systemd.user.services.opentabletdriver = with pkgs; mkIf cfg.daemon.enable { + description = "Open source, cross-platform, user-mode tablet driver"; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + + serviceConfig = { + Type = "simple"; + ExecStart = "${opentabletdriver}/bin/otd-daemon -c ${opentabletdriver}/lib/OpenTabletDriver/Configurations"; + Restart = "on-failure"; + }; + }; + }; +} -- cgit 1.4.1 From a2391053b6cceb1933b99f656f8b3a39b8df411c Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 1 Jan 2021 18:14:06 -0300 Subject: nixos/opentabletdriver: add package option --- nixos/modules/hardware/opentabletdriver.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'nixos/modules/hardware/opentabletdriver.nix') diff --git a/nixos/modules/hardware/opentabletdriver.nix b/nixos/modules/hardware/opentabletdriver.nix index b759bcf034e..0f34d903f68 100644 --- a/nixos/modules/hardware/opentabletdriver.nix +++ b/nixos/modules/hardware/opentabletdriver.nix @@ -24,6 +24,15 @@ in ''; }; + package = mkOption { + type = types.package; + default = pkgs.opentabletdriver; + defaultText = "pkgs.opentabletdriver"; + description = '' + OpenTabletDriver derivation to use. + ''; + }; + daemon = { enable = mkOption { default = true; @@ -37,9 +46,9 @@ in }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ opentabletdriver ]; + environment.systemPackages = [ cfg.package ]; - services.udev.packages = with pkgs; [ opentabletdriver ]; + services.udev.packages = [ cfg.package ]; boot.blacklistedKernelModules = cfg.blacklistedKernelModules; @@ -50,7 +59,7 @@ in serviceConfig = { Type = "simple"; - ExecStart = "${opentabletdriver}/bin/otd-daemon -c ${opentabletdriver}/lib/OpenTabletDriver/Configurations"; + ExecStart = "${cfg.package}/bin/otd-daemon -c ${cfg.package}/lib/OpenTabletDriver/Configurations"; Restart = "on-failure"; }; }; -- cgit 1.4.1 From 0573b54e29854cd133d9ab71a0533dc9d22d6403 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 8 Jan 2021 18:53:33 -0300 Subject: nixos/opentabletdriver: add thiagokokada as maintainer --- nixos/modules/hardware/opentabletdriver.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nixos/modules/hardware/opentabletdriver.nix') diff --git a/nixos/modules/hardware/opentabletdriver.nix b/nixos/modules/hardware/opentabletdriver.nix index 0f34d903f68..295e23e6164 100644 --- a/nixos/modules/hardware/opentabletdriver.nix +++ b/nixos/modules/hardware/opentabletdriver.nix @@ -5,6 +5,8 @@ let cfg = config.hardware.opentabletdriver; in { + meta.maintainers = with lib.maintainers; [ thiagokokada ]; + options = { hardware.opentabletdriver = { enable = mkOption { -- cgit 1.4.1