2020-12-27 22:29:25 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.hardware.opentabletdriver;
|
|
|
|
in
|
|
|
|
{
|
2021-01-08 22:53:33 +01:00
|
|
|
meta.maintainers = with lib.maintainers; [ thiagokokada ];
|
|
|
|
|
2020-12-27 22:29:25 +01:00
|
|
|
options = {
|
|
|
|
hardware.opentabletdriver = {
|
2024-08-24 22:05:29 +02:00
|
|
|
enable = lib.mkOption {
|
2020-12-27 22:29:25 +01:00
|
|
|
default = false;
|
2024-08-24 22:05:29 +02:00
|
|
|
type = lib.types.bool;
|
2020-12-27 22:29:25 +01:00
|
|
|
description = ''
|
|
|
|
Enable OpenTabletDriver udev rules, user service and blacklist kernel
|
|
|
|
modules known to conflict with OpenTabletDriver.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-08-24 22:05:29 +02:00
|
|
|
blacklistedKernelModules = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
2020-12-27 22:29:25 +01:00
|
|
|
default = [ "hid-uclogic" "wacom" ];
|
|
|
|
description = ''
|
|
|
|
Blacklist of kernel modules known to conflict with OpenTabletDriver.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-08-24 22:05:29 +02:00
|
|
|
package = lib.mkPackageOption pkgs "opentabletdriver" { };
|
2021-01-01 22:14:06 +01:00
|
|
|
|
2020-12-27 22:29:25 +01:00
|
|
|
daemon = {
|
2024-08-24 22:05:29 +02:00
|
|
|
enable = lib.mkOption {
|
2020-12-27 22:29:25 +01:00
|
|
|
default = true;
|
2024-08-24 22:05:29 +02:00
|
|
|
type = lib.types.bool;
|
2020-12-27 22:29:25 +01:00
|
|
|
description = ''
|
|
|
|
Whether to start OpenTabletDriver daemon as a systemd user service.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-24 22:05:29 +02:00
|
|
|
config = lib.mkIf cfg.enable {
|
2021-01-01 22:14:06 +01:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
2020-12-27 22:29:25 +01:00
|
|
|
|
2021-01-01 22:14:06 +01:00
|
|
|
services.udev.packages = [ cfg.package ];
|
2020-12-27 22:29:25 +01:00
|
|
|
|
|
|
|
boot.blacklistedKernelModules = cfg.blacklistedKernelModules;
|
|
|
|
|
2024-08-24 22:05:29 +02:00
|
|
|
systemd.user.services.opentabletdriver = with pkgs; lib.mkIf cfg.daemon.enable {
|
2020-12-27 22:29:25 +01:00
|
|
|
description = "Open source, cross-platform, user-mode tablet driver";
|
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
partOf = [ "graphical-session.target" ];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
2023-01-05 16:15:08 +01:00
|
|
|
ExecStart = "${cfg.package}/bin/otd-daemon";
|
2020-12-27 22:29:25 +01:00
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|