2021-01-05 17:05:55 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.hardware.opentabletdriver;
|
|
|
|
in
|
|
|
|
{
|
2021-01-09 10:05:03 +00:00
|
|
|
meta.maintainers = with lib.maintainers; [ thiagokokada ];
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
options = {
|
|
|
|
hardware.opentabletdriver = {
|
2024-09-19 14:19:46 +00:00
|
|
|
enable = lib.mkOption {
|
2021-01-05 17:05:55 +00:00
|
|
|
default = false;
|
2024-09-19 14:19:46 +00:00
|
|
|
type = lib.types.bool;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2021-01-05 17:05:55 +00:00
|
|
|
Enable OpenTabletDriver udev rules, user service and blacklist kernel
|
|
|
|
modules known to conflict with OpenTabletDriver.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
blacklistedKernelModules = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
2021-01-05 17:05:55 +00:00
|
|
|
default = [ "hid-uclogic" "wacom" ];
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2021-01-05 17:05:55 +00:00
|
|
|
Blacklist of kernel modules known to conflict with OpenTabletDriver.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
package = lib.mkPackageOption pkgs "opentabletdriver" { };
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
daemon = {
|
2024-09-19 14:19:46 +00:00
|
|
|
enable = lib.mkOption {
|
2021-01-05 17:05:55 +00:00
|
|
|
default = true;
|
2024-09-19 14:19:46 +00:00
|
|
|
type = lib.types.bool;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2021-01-05 17:05:55 +00:00
|
|
|
Whether to start OpenTabletDriver daemon as a systemd user service.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2021-01-05 17:05:55 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
|
|
|
|
services.udev.packages = [ cfg.package ];
|
|
|
|
|
|
|
|
boot.blacklistedKernelModules = cfg.blacklistedKernelModules;
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
systemd.user.services.opentabletdriver = with pkgs; lib.mkIf cfg.daemon.enable {
|
2021-01-05 17:05:55 +00:00
|
|
|
description = "Open source, cross-platform, user-mode tablet driver";
|
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
partOf = [ "graphical-session.target" ];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
2023-01-11 07:51:40 +00:00
|
|
|
ExecStart = "${cfg.package}/bin/otd-daemon";
|
2021-01-05 17:05:55 +00:00
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|