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: init package with nixos module #285660

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 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 @@ -13171,6 +13171,12 @@
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
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,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
35 changes: 35 additions & 0 deletions nixos/modules/programs/xppen.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:

with lib; let
nasrally marked this conversation as resolved.
Show resolved Hide resolved
cfg = config.programs.xppen;
in

{
options.programs.xppen = {
enable = mkEnableOption (lib.mdDoc "XPPen PenTablet application");
nasrally marked this conversation as resolved.
Show resolved Hide resolved
package = mkPackageOption pkgs "xppen" { };
};

config = mkIf cfg.enable {
hardware.uinput.enable = true;

environment.systemPackages = [
cfg.package
];
nasrally marked this conversation as resolved.
Show resolved Hide resolved

services.udev.packages = [ cfg.package ];

system.activationScripts.xppen.text = with pkgs; ''
nasrally marked this conversation as resolved.
Show resolved Hide resolved
install -m 755 -d "/var/lib/pentablet/conf/xppen"

readarray -d "" files < <(find ${xppen}/usr/lib/pentablet/conf -type f -print0)

for file in "''${files[@]}"; do
file_new="/var''${file#${xppen + "/usr"}}"
nasrally marked this conversation as resolved.
Show resolved Hide resolved
if [ ! -f $file_new ]; then
install -m 666 "''$file" "''$file_new"
fi
done
'';
};
}
64 changes: 64 additions & 0 deletions pkgs/by-name/xp/xppen/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{ stdenv
, lib
, fetchzip
, autoPatchelfHook

, libusb1
, qt5
, libGL
}:
stdenv.mkDerivation {
pname = "xppen";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #285660 (comment) for explanation

Suggested change
pname = "xppen";
pname = "xppen_3";

version = "3.4.9";

src = fetchzip {
extension = "tar.gz";
url = "https://www.xp-pen.com/download/file.html?id=1936&pid=990&ext=gz";
hash = "sha256-A/dv6DpelH0NHjlGj32tKv37S+9q3F8cYByiYlMuqLg=";
};

nativeBuildInputs = [ autoPatchelfHook qt5.wrapQtAppsHook ];

buildInputs = [ qt5.full libusb1 libGL ];

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

installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/doc $out/usr/lib/pentablet

cp -r App/usr/share/. $out/share
cp -r App/usr/lib/pentablet/doc/. $out/share/doc
cp -r App/lib $out/lib

cp -r App/usr/lib/pentablet/. $out/bin/
cp -r $out/bin/conf $out/usr/lib/pentablet

rm $out/bin/PenTablet.sh
rm -r $out/bin/conf
rm -r $out/bin/doc
rm -r $out/bin/lib
rm -r $out/bin/platforms
runHook postInstall
'';

postInstall = ''
sed -i 's#/usr/lib/pentablet#/var/lib/pentablet#g' $out/bin/PenTablet
nasrally marked this conversation as resolved.
Show resolved Hide resolved

substituteInPlace $out/share/applications/xppentablet.desktop \
--replace "/usr/lib/pentablet/PenTablet.sh" "PenTablet" \
nasrally marked this conversation as resolved.
Show resolved Hide resolved
--replace "/usr/share/icons/hicolor/256x256/apps/xppentablet.png" "xppentablet"
nasrally marked this conversation as resolved.
Show resolved Hide resolved
'';

meta = with lib; {
description = "XPPen driver";
homepage = "https://www.xp-pen.com/";
downloadPage = "https://www.xp-pen.com/download/";
license = licenses.unfree;
maintainers = with maintainers; [ nasrally ];
mainProgram = "PenTablet";
platforms = platforms.linux;
};
}
Loading