1{
2 stdenv,
3 lib,
4 fetchzip,
5 replaceVars,
6 dpkg,
7 autoPatchelfHook,
8 cups,
9 tcl,
10 tk,
11 xorg,
12 makeWrapper,
13}:
14let
15 debPlatform =
16 if stdenv.hostPlatform.system == "x86_64-linux" then
17 "amd64"
18 else if stdenv.hostPlatform.system == "i686-linux" then
19 "i386"
20 else
21 throw "Unsupported system: ${stdenv.hostPlatform.system}";
22in
23stdenv.mkDerivation rec {
24 pname = "fxlinuxprintutil";
25 version = "1.1.1-1";
26
27 # https://support-fb.fujifilm.com/driver_downloads/fxlinuxpdf112119031.zip is gone
28 src = fetchzip {
29 url = "https://github.com/NixOS/nixpkgs/files/12232817/fxlinuxpdf112119031.zip";
30 sha256 = "1mv07ch6ysk9bknfmjqsgxb803sj6vfin29s9knaqv17jvgyh0n3";
31 };
32
33 patches = [
34 # replaces references to “path/to/fxlputil” via $0 that are broken by our wrapProgram
35 # with /nix/store/fxlinuxprintutil/bin/fxlputil
36 ./fxlputil.patch
37
38 # replaces the code that looks for Tcl packages in the working directory and /usr/lib
39 # or /usr/lib64 with /nix/store/fxlinuxprintutil/lib
40 ./fxlputil.tcl.patch
41
42 # replaces the code that looks for X11’s locale.alias in /usr/share/X11/locale or
43 # /usr/lib/X11/locale with /nix/store/libX11/share/X11/locale
44 (replaceVars ./fxlocalechk.tcl.patch {
45 inherit (xorg) libX11;
46 })
47 ];
48
49 nativeBuildInputs = [
50 dpkg
51 autoPatchelfHook
52 makeWrapper
53 ];
54 buildInputs = [
55 cups
56 tcl
57 tk
58 ];
59
60 sourceRoot = ".";
61 unpackCmd = "dpkg-deb -x $curSrc/fxlinuxprintutil_${version}_${debPlatform}.deb .";
62
63 dontConfigure = true;
64 dontBuild = true;
65
66 installPhase = ''
67 mkdir -p $out
68 mv usr/bin $out
69 mv usr/lib $out
70
71 wrapProgram $out/bin/fxlputil --prefix PATH : ${
72 lib.makeBinPath [
73 tcl
74 tk
75 ]
76 }
77 '';
78
79 meta = with lib; {
80 description = "Optional configuration tool for fxlinuxprint";
81 homepage = "https://onlinesupport.fujixerox.com";
82 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
83 license = licenses.unfree;
84 maintainers = [ ];
85 platforms = platforms.linux;
86 };
87}