nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 cups,
5 fetchurl,
6 patchPpdFilesHook,
7 autoPatchelfHook,
8 dpkg,
9 perl,
10 avahi,
11}:
12
13stdenv.mkDerivation {
14 pname = "lexmark-aex";
15 version = "1.0";
16
17 dontPatchELF = true;
18 dontStrip = true;
19
20 src = fetchurl {
21 url = "https://downloads.lexmark.com/downloads/drivers/Lexmark-AEX-PPD-Files-1.0-01242019.amd64.deb";
22 hash = "sha256-igrJEeFLArGbncOwk/WttnWfPjOokD0/IzpJ4VSOtHk=";
23 };
24
25 strictDeps = true;
26
27 nativeBuildInputs = [
28 autoPatchelfHook
29 patchPpdFilesHook
30 dpkg
31 ];
32
33 buildInputs = [
34 # Needed for autoPatchelfHook.
35 avahi
36 cups
37 # Needed for patchShebangs.
38 perl
39 ];
40
41 # Needed for autoPatchelfHook.
42 runtimeDependencies = [ (lib.getLib cups) ];
43
44 ppdFileCommands = [
45 "CommandFileFilterG2"
46 "rerouteprintoption"
47 ];
48
49 installPhase =
50 let
51 libdir =
52 if stdenv.system == "x86_64-linux" then
53 "lib64"
54 else if stdenv.system == "i686_linux" then
55 "lib"
56 else
57 throw "other platforms than i686_linux and x86_64-linux are not yet supported";
58 in
59 ''
60 runHook preInstall
61
62 prefix=usr/local/Lexmark/ppd/Lexmark-AEX-PPD-Files/GlobalPPD_1.4
63
64 # Install raster image filter.
65 install -Dm755 "$prefix/rerouteprintoption" "$out/lib/cups/filter/rerouteprintoption"
66 patchShebangs "$out/lib/cups/filter/rerouteprintoption"
67
68 # Install additional binary filters.
69 for i in CommandFileFilterG2 LexHBPFilter; do
70 install -Dm755 "$prefix/${libdir}/$i" "$out/lib/cups/filter/$i"
71 done
72
73 # Install PPD.
74 install -Dm 0644 -t "$out/share/cups/model/Lexmark" "$prefix"/*.ppd
75
76 runHook postInstall
77 '';
78
79 meta = {
80 description = "CUPS drivers for Lexmark B2200 and MB2200 Series printers";
81 homepage = "https://support.lexmark.com/en_xm/drivers-downloads.html";
82 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
83 license = lib.licenses.unfree;
84 maintainers = [ lib.maintainers.tobim ];
85 platforms = [
86 "x86_64-linux"
87 "i686-linux"
88 ];
89 };
90}