From 7726f07c68a9939fffd98541ec3cf987f14325e6 Mon Sep 17 00:00:00 2001 From: yakrobat Date: Fri, 2 Feb 2024 05:45:28 +0300 Subject: [PATCH 1/5] maintainers: add nasrally --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) 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; From 84b89bc48949b286cc4c44b110220b36bc0f4f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 27 Oct 2024 10:44:26 +0100 Subject: [PATCH 2/5] xppen_3: init at 3.4.9-240131 Co-authored-by: yakrobat --- pkgs/by-name/xp/xppen_3/package.nix | 67 +++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 pkgs/by-name/xp/xppen_3/package.nix diff --git a/pkgs/by-name/xp/xppen_3/package.nix b/pkgs/by-name/xp/xppen_3/package.nix new file mode 100644 index 0000000000000..4132eda63da0a --- /dev/null +++ b/pkgs/by-name/xp/xppen_3/package.nix @@ -0,0 +1,67 @@ +{ + lib, + stdenv, + fetchzip, + autoPatchelfHook, + qt5, + libusb1, +}: + +stdenv.mkDerivation { + pname = "xppen_3"; + version = "3.4.9-240131"; + + # to update: try to find the latest 3.x.x .tar.gz on https://www.xp-pen.com/download + src = fetchzip { + extension = "tar.gz"; + url = "https://www.xp-pen.com/download/file.html?id=2829&pid=1016&ext=gz"; + hash = "sha256-udUjkOW6nGo8zvMhVl6Iepa6OzCVz/M9m+DMqNKrfFg="; + }; + + 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 ]; + }; +} From a63aaca8580c750f635bd0274a4cb0efe38c9661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 27 Oct 2024 11:59:29 +0100 Subject: [PATCH 3/5] xppen_4: init at 4.0.4-240815 --- pkgs/by-name/xp/xppen_4/package.nix | 67 +++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 pkgs/by-name/xp/xppen_4/package.nix diff --git a/pkgs/by-name/xp/xppen_4/package.nix b/pkgs/by-name/xp/xppen_4/package.nix new file mode 100644 index 0000000000000..0ac2e10aa97c7 --- /dev/null +++ b/pkgs/by-name/xp/xppen_4/package.nix @@ -0,0 +1,67 @@ +{ + lib, + stdenv, + fetchzip, + autoPatchelfHook, + qt5, + libusb1, +}: + +stdenv.mkDerivation { + pname = "xppen_4"; + version = "4.0.4-240815"; + + # to update: try to find the latest 4.x.x .tar.gz on https://www.xp-pen.com/download + src = fetchzip { + extension = "tar.gz"; + url = "https://www.xp-pen.com/download/file.html?id=3325&pid=1016&ext=gz"; + hash = "sha256-NVO9VaUmcQDI4rL76BBQDmII8vpmmo9qgcGetv6CIFE="; + }; + + 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 ]; + }; +} From 1b4ab0b6444047ae60631b7908999958933a0c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 8 Dec 2024 01:33:03 +0100 Subject: [PATCH 4/5] nixos/xppen: init Co-authored-by: yakrobat --- .../manual/release-notes/rl-2505.section.md | 2 + nixos/modules/module-list.nix | 1 + nixos/modules/programs/xppen.nix | 53 +++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 nixos/modules/programs/xppen.nix 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 + ''; + }; + }; + }; +} From 93e171b790915263091d55adb2111664508d9c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 10 Nov 2024 10:34:46 +0100 Subject: [PATCH 5/5] xppen_{3,4}: deduplicate common code --- pkgs/applications/misc/xppen/default.nix | 19 ++++++ .../misc/xppen/generic.nix} | 11 +-- pkgs/by-name/xp/xppen_4/package.nix | 67 ------------------- pkgs/top-level/all-packages.nix | 3 + 4 files changed, 28 insertions(+), 72 deletions(-) create mode 100644 pkgs/applications/misc/xppen/default.nix rename pkgs/{by-name/xp/xppen_3/package.nix => applications/misc/xppen/generic.nix} (82%) delete mode 100644 pkgs/by-name/xp/xppen_4/package.nix 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/by-name/xp/xppen_3/package.nix b/pkgs/applications/misc/xppen/generic.nix similarity index 82% rename from pkgs/by-name/xp/xppen_3/package.nix rename to pkgs/applications/misc/xppen/generic.nix index 4132eda63da0a..0d7952841b7ff 100644 --- a/pkgs/by-name/xp/xppen_3/package.nix +++ b/pkgs/applications/misc/xppen/generic.nix @@ -5,17 +5,18 @@ autoPatchelfHook, qt5, libusb1, + pname, + version, + url, + hash, }: stdenv.mkDerivation { - pname = "xppen_3"; - version = "3.4.9-240131"; + inherit pname version; - # to update: try to find the latest 3.x.x .tar.gz on https://www.xp-pen.com/download src = fetchzip { extension = "tar.gz"; - url = "https://www.xp-pen.com/download/file.html?id=2829&pid=1016&ext=gz"; - hash = "sha256-udUjkOW6nGo8zvMhVl6Iepa6OzCVz/M9m+DMqNKrfFg="; + inherit url hash; }; nativeBuildInputs = [ diff --git a/pkgs/by-name/xp/xppen_4/package.nix b/pkgs/by-name/xp/xppen_4/package.nix deleted file mode 100644 index 0ac2e10aa97c7..0000000000000 --- a/pkgs/by-name/xp/xppen_4/package.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ - lib, - stdenv, - fetchzip, - autoPatchelfHook, - qt5, - libusb1, -}: - -stdenv.mkDerivation { - pname = "xppen_4"; - version = "4.0.4-240815"; - - # to update: try to find the latest 4.x.x .tar.gz on https://www.xp-pen.com/download - src = fetchzip { - extension = "tar.gz"; - url = "https://www.xp-pen.com/download/file.html?id=3325&pid=1016&ext=gz"; - hash = "sha256-NVO9VaUmcQDI4rL76BBQDmII8vpmmo9qgcGetv6CIFE="; - }; - - 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 { };