nix_config/machines/buck/xp_pen_pentablet.nix
2023-09-13 07:30:18 -04:00

97 lines
2.6 KiB
Nix

# MIT License
#
# Copyright (c) 2021 Peter Willemsen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Modified from https://github.com/peterwilli/XP-Pen-Pentablet-Driver-for-Nixos
{ stdenv
, lib
, fetchurl
, glib
, dbus
, dpkg
, autoPatchelfHook
, writeShellScript
, curl
, jq
, makeWrapper
, fontconfig
, libusb
, freetype
, zlib
, libGL
, xorg
, libxcb
, common-updater-scripts
}:
stdenv.mkDerivation rec {
pname = "xp_pen_driver";
version = "3.3.9.230222-1";
src = fetchurl {
#url = "https://github.com/peterwilli/XP-Pen-Pentablet-Driver-for-Nixos/releases/download/3.2.0.210804-1/XP-PEN-pentablet-3.2.0.210804-1.x86_64.deb";
#sha256 = "01zhaxar009jck3fi6ms79f4z0wd630xzplhyviilvcaghxh4vl0";
url = "https://www.xp-pen.com/download/file/id/1949/pid/67/ext/deb.html";
sha256 = "77f90a825c170f8b1ad32ee744e1fc7e58028952384b31eb4393343c06a6e0f8";
};
nativeBuildInputs = [
dpkg
libxcb
zlib
libGL
libusb
dbus
fontconfig
glib
freetype
makeWrapper
xorg.libSM
xorg.libXext
xorg.libXtst
xorg.libX11
xorg.libXrender
autoPatchelfHook
];
dontUnpack = true;
installPhase = ''
runHook preInstall
dpkg-deb -x $src $out
chmod 755 "$out"
chmod a+x $out/usr/lib/pentablet/pentablet.sh
chmod a+x $out/usr/lib/pentablet/pentablet
runHook postInstall
mkdir -p $out/bin
makeWrapper $out/usr/lib/pentablet/pentablet.sh $out/bin/pentablet
'';
meta = with lib; {
description = "Proprietary driver for XP-Pen tablets";
homepage = "https://www.xp-pen.com/";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
};
}