Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xppen_{3,4}: init at {3.4.9-240131,4.0.4-240815}; nixos/xppen: init #351647

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15447,6 +15447,12 @@
name = "Nasir Hussain";
keys = [ { fingerprint = "7A10 AB8E 0BEC 566B 090C 9BE3 D812 6E55 9CE7 C35D"; } ];
};
nasrally = {
email = "[email protected]";
github = "nasrally";
githubId = 50599445;
name = "Nikita Grishko";
};
nat-418 = {
github = "nat-418";
githubId = 93013864;
Expand Down
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2505.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

- [Kimai](https://www.kimai.org/), a web-based multi-user time-tracking application. Available as [services.kimai](options.html#opt-services.kimai).

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

- [Omnom](https://github.com/asciimoo/omnom), a webpage bookmarking and snapshotting service. Available as [services.omnom](options.html#opt-services.omnom.enable).

- [Traccar](https://www.traccar.org/), a modern GPS Tracking Platform. Available as [services.traccar](#opt-services.traccar.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 @@ -331,6 +331,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 777 -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
'';
};
};
};
}
19 changes: 19 additions & 0 deletions pkgs/applications/misc/xppen/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
callPackage,
}:

# to update: try to find the latest 3.x.x or 4.x.x .tar.gz on https://www.xp-pen.com/download
{
xppen_3 = callPackage ./generic.nix {
pname = "xppen_3";
version = "3.4.9-240131";
url = "https://www.xp-pen.com/download/file.html?id=2829&pid=1016&ext=gz";
hash = "sha256-udUjkOW6nGo8zvMhVl6Iepa6OzCVz/M9m+DMqNKrfFg=";
};
xppen_4 = callPackage ./generic.nix {
pname = "xppen_4";
version = "4.0.4-240815";
url = "https://www.xp-pen.com/download/file.html?id=3325&pid=1016&ext=gz";
hash = "sha256-NVO9VaUmcQDI4rL76BBQDmII8vpmmo9qgcGetv6CIFE=";
};
}
68 changes: 68 additions & 0 deletions pkgs/applications/misc/xppen/generic.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
lib,
stdenv,
fetchzip,
autoPatchelfHook,
qt5,
libusb1,
pname,
version,
url,
hash,
}:

stdenv.mkDerivation {
inherit pname version;

src = fetchzip {
extension = "tar.gz";
inherit url hash;
};

nativeBuildInputs = [
autoPatchelfHook
qt5.wrapQtAppsHook
];

buildInputs = [
qt5.qtbase
libusb1
];

dontConfigure = true;
dontBuild = true;
dontCheck = true;

installPhase = ''
runHook preInstall

rm -r App/usr/lib/pentablet/{lib,platforms,PenTablet.sh}
mkdir -p $out/{bin,usr}
cp -r App/lib $out/lib
cp -r App/usr/share $out/share
cp -r App/usr/lib $out/usr/lib

sed -i 's#/usr/lib/pentablet#/var/lib/pentablet#g' $out/usr/lib/pentablet/PenTablet
ln -s $out/usr/lib/pentablet/PenTablet $out/bin/PenTablet

substituteInPlace $out/share/applications/xppentablet.desktop \
--replace-fail "/usr/lib/pentablet/PenTablet.sh" "PenTablet" \
--replace-fail "/usr/share/icons/hicolor/256x256/apps/xppentablet.png" "xppentablet"

runHook postInstall
'';

meta = {
description = "XPPen driver";
downloadPage = "https://www.xp-pen.com/download/";
homepage = "https://www.xp-pen.com/";
license = lib.licenses.unfree;
mainProgram = "PenTablet";
maintainers = with lib.maintainers; [
gepbird
nasrally
];
platforms = [ "x86_64-linux" ];
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
}
3 changes: 3 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16266,6 +16266,9 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) AudioUnit CoreAudio;
};

inherit (callPackage ../applications/misc/xppen { })
xppen_3 xppen_4;

xygrib = libsForQt5.callPackage ../applications/misc/xygrib { };

yabar = callPackage ../applications/window-managers/yabar { };
Expand Down
Loading