diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index effe1f76b9202..f7ea5d78e6c95 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -15447,6 +15447,12 @@ name = "Nasir Hussain"; keys = [ { fingerprint = "7A10 AB8E 0BEC 566B 090C 9BE3 D812 6E55 9CE7 C35D"; } ]; }; + nasrally = { + email = "suffer.ring@ya.ru"; + github = "nasrally"; + githubId = 50599445; + name = "Nikita Grishko"; + }; nat-418 = { github = "nat-418"; githubId = 93013864; diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index 8b046f0568c75..d0fecc929b758 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -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). diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index afed4b049ebd0..ccddd408e6aec 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 diff --git a/nixos/modules/programs/xppen.nix b/nixos/modules/programs/xppen.nix new file mode 100644 index 0000000000000..13c168fe4b28f --- /dev/null +++ b/nixos/modules/programs/xppen.nix @@ -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 + ''; + }; + }; + }; +} diff --git a/pkgs/applications/misc/xppen/default.nix b/pkgs/applications/misc/xppen/default.nix new file mode 100644 index 0000000000000..18458cfbe5851 --- /dev/null +++ b/pkgs/applications/misc/xppen/default.nix @@ -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="; + }; +} diff --git a/pkgs/applications/misc/xppen/generic.nix b/pkgs/applications/misc/xppen/generic.nix new file mode 100644 index 0000000000000..0d7952841b7ff --- /dev/null +++ b/pkgs/applications/misc/xppen/generic.nix @@ -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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3e234d8ca8104..677889d8a3089 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };