Skip to content

Commit

Permalink
nixos/xppen: init
Browse files Browse the repository at this point in the history
Co-authored-by: yakrobat <[email protected]>
  • Loading branch information
gepbird and nasrally committed Oct 27, 2024
1 parent 6878d00 commit 7b5930a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@

- [Immersed](https://immersed.com/), a closed-source coworking platform. Available as [programs.immersed](#opt-programs.immersed.enable).

- [XPPen](https://www.xp-pen.com/), the official closed-source driver for XP Pen tablets. Available as [programs.xppen](#opt-programs.xppen.enable).

- [HomeBox](https://github.com/sysadminsmedia/homebox): the inventory and organization system built for the Home User. Available as [services.homebox](#opt-services.homebox.enable).

- [matrix-hookshot](https://matrix-org.github.io/matrix-hookshot), a Matrix bot for connecting to external services. Available as [services.matrix-hookshot](#opt-services.matrix-hookshot.enable).
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@
./programs/xfconf.nix
./programs/xfs_quota.nix
./programs/xonsh.nix
./programs/xppen.nix
./programs/xss-lock.nix
./programs/xwayland.nix
./programs/yabar.nix
Expand Down
53 changes: 53 additions & 0 deletions nixos/modules/programs/xppen.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
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.services.xppen-create-config-dir = {
restartTriggers = [ cfg.package ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
TimeoutSec = 60;
ExecStart = pkgs.writeScript "xppen-create-config-dir" ''
#!${pkgs.bash}/bin/bash
install -m 755 -d "/var/lib/pentablet/conf/xppen"
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
'';
};
};
};
}

0 comments on commit 7b5930a

Please sign in to comment.