at master 1.7 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7let 8 cfg = config.hardware.opentabletdriver; 9in 10{ 11 meta.maintainers = with lib.maintainers; [ thiagokokada ]; 12 13 options = { 14 hardware.opentabletdriver = { 15 enable = lib.mkOption { 16 default = false; 17 type = lib.types.bool; 18 description = '' 19 Enable OpenTabletDriver udev rules, user service and blacklist kernel 20 modules known to conflict with OpenTabletDriver. 21 ''; 22 }; 23 24 blacklistedKernelModules = lib.mkOption { 25 type = lib.types.listOf lib.types.str; 26 default = [ 27 "hid-uclogic" 28 "wacom" 29 ]; 30 description = '' 31 Blacklist of kernel modules known to conflict with OpenTabletDriver. 32 ''; 33 }; 34 35 package = lib.mkPackageOption pkgs "opentabletdriver" { }; 36 37 daemon = { 38 enable = lib.mkOption { 39 default = true; 40 type = lib.types.bool; 41 description = '' 42 Whether to start OpenTabletDriver daemon as a systemd user service. 43 ''; 44 }; 45 }; 46 }; 47 }; 48 49 config = lib.mkIf cfg.enable { 50 environment.systemPackages = [ cfg.package ]; 51 52 services.udev.packages = [ cfg.package ]; 53 54 boot.blacklistedKernelModules = cfg.blacklistedKernelModules; 55 56 systemd.user.services.opentabletdriver = lib.mkIf cfg.daemon.enable { 57 description = "Open source, cross-platform, user-mode tablet driver"; 58 wantedBy = [ "graphical-session.target" ]; 59 partOf = [ "graphical-session.target" ]; 60 61 serviceConfig = { 62 Type = "simple"; 63 ExecStart = lib.getExe' cfg.package "otd-daemon"; 64 Restart = "on-failure"; 65 }; 66 }; 67 }; 68}