nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchzip
4, libusb1
5, cups
6, dpkg
7, libjpeg8
8, makeWrapper
9, autoPatchelfHook
10, enablePtqpdf ? false # Pantum's version of qpdf
11}:
12
13let
14 architecture = {
15 i686-linux = "i386";
16 x86_64-linux = "amd64";
17 }.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}");
18in
19stdenv.mkDerivation rec {
20 pname = "pantum-driver";
21 version = "1.1.84";
22
23 src = fetchzip {
24 url = "https://drivers.pantum.com/Pantum_Ubuntu_Driver_V${version}_1.zip";
25 sha256 = "sha256-UJzYBsGj/TMhQoMourx7UPGBpN0MPi4pEN8m1sXLw/g=";
26 };
27
28 buildInputs = [ libusb1 libjpeg8 cups ];
29 nativeBuildInputs = [ dpkg autoPatchelfHook ];
30
31 installPhase = ''
32 dpkg-deb -x ./Resources/pantum_${version}-1_${architecture}.deb .
33
34 mkdir -p $out $out/lib
35 cp -r etc $out/
36 cp -r usr/lib/cups $out/lib/
37 cp -r usr/local/lib/* $out/lib/
38 cp -r usr/share $out/
39 cp Resources/locale/en_US.UTF-8/* $out/share/doc/pantum/
40 '' + lib.optionalString enablePtqpdf ''
41 cp -r opt/pantum/* $out/
42 ln -s $out/lib/libqpdf.so* $out/lib/libqpdf.so
43 ln -s $out/lib/libqpdf.so $out/lib/libqpdf.so.21
44 '';
45
46 meta = {
47 description = "Pantum universal driver";
48 homepage = "https://global.pantum.com/";
49 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
50 license = lib.licenses.unfree;
51 platforms = [ "i686-linux" "x86_64-linux" ];
52 };
53}