summaryrefslogtreecommitdiff
path: root/pkgs/huion.nix
blob: 5e2234090c81b5f18c2036cc5d96a2c1cc55aac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
  lib,
  stdenv,
  autoPatchelfHook,
  dpkg,
  dbus,
  fetchurl,
  freetype,
  fontconfig,
  libusb1,
  glib,
  krb5,
  libsForQt5,
  makeWrapper,
  mesa,
  systemd,
  xkbd,
  xorg,
  zlib,
  ...
}:
stdenv.mkDerivation rec {
  pname = "huion-g930l-driver";
  version = "15.0.0.103";

  src = fetchurl {
    url = "https://driverdl.huion.com/driver/X10_G930L_Q630M/HuionTablet_v15.0.0.103.202208301443.x86_64.deb";
    sha256 = "sha256-xOefpUj6V/XvEmtl8ETkmZgLtlHSyRzsZSZfhkQFtsg=";
  };

  sourceRoot = ".";
  unpackCmd = "dpkg-deb -x $src .";

  nativeBuildInputs = [autoPatchelfHook dpkg makeWrapper];
  buildInputs =
    [
      dbus
      freetype
      fontconfig
      libusb1
      glib
      krb5
      mesa
      systemd
      xkbd
      xorg.libX11
      xorg.libxcb
      xorg.libXext
      xorg.libXrandr
      zlib
    ]
    ++ (with libsForQt5; [
      qt5.qtbase
      qt5.qtgamepad
      qt5.qtvirtualkeyboard
      qt5.qtxmlpatterns
      qt3d
      qtquickcontrols
      qtquickcontrols2
    ]);

  dontWrapQtApps = true;
  # is this stupid? yes
  # i don't care
  autoPatchelfIgnoreMissingDeps = ["libQt5RemoteObjects.so.5"];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    cp -R usr/{lib,share} $out/
    chmod -R g-w $out
    chmod 755 $out/lib/huiontablet/huiontablet.sh

    makeWrapper $out/lib/huiontablet/huiontablet.sh $out/bin/huiontablet \
      "''${qtappsWrapperArgs[@]}" \
      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath buildInputs}"

    substituteInPlace $out/share/applications/huiontablet.desktop \
      --replace /usr/lib/huiontablet/huiontablet.sh $out/bin/huiontablet \
      --replace /usr/share $out/share
  '';

  meta = {
    # this probably works but it hasn't been tested much so
    broken = true;
    description = "huion drivers for G930L";
    homepage = "https://www.huion.com/";
    maintainers = [lib.maintainers.getchoo];
    platforms = ["x86_64-linux"];
    sourceProvenance = [lib.sourceTypes.binaryNativeCode];
  };
}