0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

nixos/hardware.opentabletdriver: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-24 22:05:29 +02:00
parent 78026acac2
commit 76c3bcd9e3

View file

@ -1,6 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.hardware.opentabletdriver; cfg = config.hardware.opentabletdriver;
in in
@ -9,29 +7,29 @@ in
options = { options = {
hardware.opentabletdriver = { hardware.opentabletdriver = {
enable = mkOption { enable = lib.mkOption {
default = false; default = false;
type = types.bool; type = lib.types.bool;
description = '' description = ''
Enable OpenTabletDriver udev rules, user service and blacklist kernel Enable OpenTabletDriver udev rules, user service and blacklist kernel
modules known to conflict with OpenTabletDriver. modules known to conflict with OpenTabletDriver.
''; '';
}; };
blacklistedKernelModules = mkOption { blacklistedKernelModules = lib.mkOption {
type = types.listOf types.str; type = lib.types.listOf lib.types.str;
default = [ "hid-uclogic" "wacom" ]; default = [ "hid-uclogic" "wacom" ];
description = '' description = ''
Blacklist of kernel modules known to conflict with OpenTabletDriver. Blacklist of kernel modules known to conflict with OpenTabletDriver.
''; '';
}; };
package = mkPackageOption pkgs "opentabletdriver" { }; package = lib.mkPackageOption pkgs "opentabletdriver" { };
daemon = { daemon = {
enable = mkOption { enable = lib.mkOption {
default = true; default = true;
type = types.bool; type = lib.types.bool;
description = '' description = ''
Whether to start OpenTabletDriver daemon as a systemd user service. Whether to start OpenTabletDriver daemon as a systemd user service.
''; '';
@ -40,14 +38,14 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ]; environment.systemPackages = [ cfg.package ];
services.udev.packages = [ cfg.package ]; services.udev.packages = [ cfg.package ];
boot.blacklistedKernelModules = cfg.blacklistedKernelModules; boot.blacklistedKernelModules = cfg.blacklistedKernelModules;
systemd.user.services.opentabletdriver = with pkgs; mkIf cfg.daemon.enable { systemd.user.services.opentabletdriver = with pkgs; lib.mkIf cfg.daemon.enable {
description = "Open source, cross-platform, user-mode tablet driver"; description = "Open source, cross-platform, user-mode tablet driver";
wantedBy = [ "graphical-session.target" ]; wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ]; partOf = [ "graphical-session.target" ];