Luke Granger-Brown
57725ef3ec
git-subtree-dir: third_party/nixpkgs git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
60 lines
1.6 KiB
Nix
60 lines
1.6 KiB
Nix
{ 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";
|
|
};
|
|
};
|
|
};
|
|
}
|