Unverified Commit 70469150 authored by Gutyina Gergő's avatar Gutyina Gergő
Browse files

xppen_{3,4}: init at 3.4.9-240607 and 4.0.7-250117



Co-authored-by: default avataryakrobat <yakrobat@protonmail.com>
parent 44da664d
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
{
  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=";
  };
}
+71 −0
Original line number Diff line number Diff line
{
  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 ];
  };
}
+5 −0
Original line number Diff line number Diff line
@@ -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;