nixos/xppen: init

Co-authored-by: yakrobat <yakrobat@protonmail.com>
This commit is contained in:
Gutyina Gergő
2025-08-08 09:33:34 +02:00
parent 70469150c9
commit c29545ba8d
3 changed files with 58 additions and 0 deletions

View File

@@ -31,6 +31,8 @@
- [Homebridge](https://github.com/homebridge/homebridge), a lightweight Node.js server you can run on your home network that emulates the iOS HomeKit API. Available as [services.homebridge](#opt-services.homebridge.enable).
- [XPPen](https://www.xp-pen.com/), the official closed-source driver for XP Pen tablets. Available as [programs.xppen](#opt-programs.xppen.enable).
- [LACT](https://github.com/ilya-zlobintsev/LACT), a GPU monitoring and configuration tool, can now be enabled through [services.lact.enable](#opt-services.lact.enable).
Note that for LACT to work properly on AMD GPU systems, you need to enable [hardware.amdgpu.overdrive.enable](#opt-hardware.amdgpu.overdrive.enable).

View File

@@ -357,6 +357,7 @@
./programs/xfconf.nix
./programs/xfs_quota.nix
./programs/xonsh.nix
./programs/xppen.nix
./programs/xss-lock.nix
./programs/xwayland.nix
./programs/yazi.nix

View File

@@ -0,0 +1,55 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.xppen;
in
{
options.programs.xppen = {
enable = lib.mkEnableOption "XPPen PenTablet application";
package = lib.mkPackageOption pkgs "xppen_4" {
example = "pkgs.xppen_3";
extraDescription = ''
Use xppen_4 for newer and xppen_3 for older tablets.
To check which version of the driver you need, go to
https://www.xp-pen.com/download/ then select your tablet
and look for the major version in the available files for Linux.
'';
};
};
config = lib.mkIf cfg.enable {
hardware.uinput.enable = true;
environment.systemPackages = [ cfg.package ];
services.udev.packages = [ cfg.package ];
systemd.tmpfiles.rules = [
"d /var/lib/pentablet/conf/xppen 0777 - - -"
];
systemd.services.xppen-create-config-dir = {
restartTriggers = [ cfg.package ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
TimeoutSec = 60;
ExecStart = pkgs.writeShellScript "xppen-create-config-dir" ''
readarray -d "" files < <(find ${cfg.package}/usr/lib/pentablet/conf -type f -print0)
for file in "''${files[@]}"; do
file_new="/var''${file#${cfg.package + "/usr"}}"
if [ ! -f $file_new ]; then
install -m 666 "''$file" "''$file_new"
fi
done
'';
};
};
};
}