forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
opentabletdriver.nix
60 lines (51 loc) · 1.63 KB
/
opentabletdriver.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ config, lib, pkgs, ... }:
let
cfg = config.hardware.opentabletdriver;
in
{
meta.maintainers = with lib.maintainers; [ thiagokokada ];
options = {
hardware.opentabletdriver = {
enable = lib.mkOption {
default = false;
type = lib.types.bool;
description = ''
Enable OpenTabletDriver udev rules, user service and blacklist kernel
modules known to conflict with OpenTabletDriver.
'';
};
blacklistedKernelModules = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "hid-uclogic" "wacom" ];
description = ''
Blacklist of kernel modules known to conflict with OpenTabletDriver.
'';
};
package = lib.mkPackageOption pkgs "opentabletdriver" { };
daemon = {
enable = lib.mkOption {
default = true;
type = lib.types.bool;
description = ''
Whether to start OpenTabletDriver daemon as a systemd user service.
'';
};
};
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
services.udev.packages = [ cfg.package ];
boot.blacklistedKernelModules = cfg.blacklistedKernelModules;
systemd.user.services.opentabletdriver = with pkgs; lib.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 = "${cfg.package}/bin/otd-daemon";
Restart = "on-failure";
};
};
};
}