diff --git a/pkgs/applications/misc/xppen/default.nix b/pkgs/applications/misc/xppen/default.nix new file mode 100644 index 000000000000..27bc92f168b3 --- /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-240607"; + url = "https://www.xp-pen.com/download/file.html?id=2901&pid=819&ext=gz"; + hash = "sha256-ZXeTlDjhryXamb7x2LxDdOtf8R9rgKPyUsdx96XchWM="; + }; + xppen_4 = callPackage ./generic.nix { + pname = "xppen_4"; + version = "4.0.7-250117"; + url = "https://www.xp-pen.com/download/file.html?id=3652&pid=1211&ext=gz"; + hash = "sha256-sH05Qquo2u0npSlv8Par/mn1w/ESO9g42CCGwBauHhU="; + }; +} diff --git a/pkgs/applications/misc/xppen/generic.nix b/pkgs/applications/misc/xppen/generic.nix new file mode 100644 index 000000000000..a48a20b2ef4c --- /dev/null +++ b/pkgs/applications/misc/xppen/generic.nix @@ -0,0 +1,71 @@ +{ + lib, + stdenv, + fetchzip, + autoPatchelfHook, + qt5, + libusb1, + pname, + version, + url, + hash, +}: + +stdenv.mkDerivation { + inherit pname version; + + src = fetchzip { + name = "XPPenLinux${version}.tar.gz"; + 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 + + # hack: edit the binary directly + # TODO: replace it with buildFHSEnv if possible? last time it caused other issues + 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 b3a9bf4d938a..3cc85d4ef09c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14077,6 +14077,11 @@ with pkgs; libxpdf = callPackage ../applications/misc/xpdf/libxpdf.nix { }; + inherit (callPackage ../applications/misc/xppen { }) + xppen_3 + xppen_4 + ; + xygrib = libsForQt5.callPackage ../applications/misc/xygrib { }; ydiff = with python3.pkgs; toPythonApplication ydiff;