@@ -0,0 +1,59 @@
1+{ stdenv, lib, fetchzip, substituteAll, dpkg, autoPatchelfHook, cups, tcl, tk, xorg, makeWrapper }:
2+let
3+ debPlatform =
4+ if stdenv.hostPlatform.system == "x86_64-linux" then "amd64"
5+ else if stdenv.hostPlatform.system == "i686-linux" then "i386"
6+ else throw "Unsupported system: ${stdenv.hostPlatform.system}";
7+in
8+stdenv.mkDerivation rec {
9+ pname = "fxlinuxprintutil";
10+ version = "1.1.1-1";
11+
12+ src = fetchzip {
13+ url = "https://onlinesupport.fujixerox.com/driver_downloads/fxlinuxpdf112119031.zip";
14+ sha256 = "1mv07ch6ysk9bknfmjqsgxb803sj6vfin29s9knaqv17jvgyh0n3";
15+ curlOpts = "--user-agent Mozilla/5.0"; # HTTP 410 otherwise
16+ };
17+
18+ patches = [
19+ # replaces references to “path/to/fxlputil” via $0 that are broken by our wrapProgram
20+ # with /nix/store/fxlinuxprintutil/bin/fxlputil
21+ ./fxlputil.patch
22+
23+ # replaces the code that looks for Tcl packages in the working directory and /usr/lib
24+ # or /usr/lib64 with /nix/store/fxlinuxprintutil/lib
25+ ./fxlputil.tcl.patch
26+
27+ # replaces the code that looks for X11’s locale.alias in /usr/share/X11/locale or
28+ # /usr/lib/X11/locale with /nix/store/libX11/share/X11/locale
29+ (substituteAll {
30+ src = ./fxlocalechk.tcl.patch;
31+ inherit (xorg) libX11;
32+ })
33+ ];
34+
35+ nativeBuildInputs = [ dpkg autoPatchelfHook makeWrapper ];
36+ buildInputs = [ cups tcl tk ];
37+
38+ sourceRoot = ".";
39+ unpackCmd = "dpkg-deb -x $curSrc/${pname}_${version}_${debPlatform}.deb .";
40+
41+ dontConfigure = true;
42+ dontBuild = true;
43+
44+ installPhase = ''
45+ mkdir -p $out
46+ mv usr/bin $out
47+ mv usr/lib $out
48+
49+ wrapProgram $out/bin/fxlputil --prefix PATH : ${lib.makeBinPath [ tcl tk ]}
50+ '';
51+
52+ meta = with stdenv.lib; {
53+ description = "Optional configuration tool for fxlinuxprint";
54+ homepage = https://onlinesupport.fujixerox.com;
55+ license = licenses.unfree;
56+ maintainers = with maintainers; [ delan ];
57+ platforms = platforms.linux;
58+ };
59+}