1 { lib, stdenv, fetchurl, rpm, cpio, zlib }:
3 /* usage: (sorry, its still impure but works!)
6 mkdir /opt/gutenprint; sudo cp -r $(nix-build -A gutenprintBin -f $NIXPGS_ALL) /opt/gutenprint
8 add the following lines to bindirCmds property of printing/cupsd.nix:
10 ln -s ${pkgs.gutenprintBin}/lib/cups/backend/* $out/lib/cups/backend/
11 ln -s ${pkgs.gutenprintBin}/lib/cups/filter/* $out/lib/cups/filter/
12 mkdir -p $out/lib/cups/model
13 cat ${pkgs.gutenprintBin}/ppds/Canon/Canon-PIXMA_iP4000-gutenprint.5.0.sim-en.ppd.gz |gunzip > $out/lib/cups/model/Canon-PIXMA_iP4000-gutenprint.5.0.sim-en.ppd
14 sed -i 's@/opt/gutenprint/cups@${pkgs.gutenprintBin}/cups@' $out/lib/cups/model/Canon-PIXMA_iP4000-gutenprint.5.0.sim-en.ppd
16 Then rebuild your system and add your printer using the the localhost:603 cups web interface
17 select the extracted .ppd file which can be found in the model directory of
18 sed -n 's/^ServerBin //p' $(sed -n 's/respawn.*-c \(.*''\) -F.*''/\1/p' /etc/event.d/cupsd)
19 (sorry, cups still doesn't see it. You could copy it into /nix/store/
20 *-cups/lib/cups/model/ and you would be able to select canon -> PIXMA 4000
21 then. I've tried that.
23 TODO tidy this all up. Find source instead of binary. Fix paths ... Find out how to check ink levels etc
28 pname = "cups-gutenprint-binary";
31 src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl {
32 url = "https://www.openprinting.org/download/printdriver/debian/dists/lsb3.1/main/binary-amd64/gutenprint_5.0.1-1lsb3.1_amd64.deb";
33 sha256 = "0an5gba6r6v54r53s2gj2fjk8fzpl4lrksjas2333528b0k8gbbc";
34 } else throw "TODO"; # get from openprint.com -> drivers -> gutenprint
36 buildInputs = [ rpm cpio ];
42 libPath = lib.makeLibraryPath [ stdenv.cc.cc zlib ];
45 ar -x $src data.tar.gz
47 cp -r opt/gutenprint $out
50 $out/cups/lib/driver/gutenprint.5.0 \
51 $out/bin/{escputil,cups-calibrate} \
52 $out/cups/lib/driver/gutenprint.5.0 \
53 $out/cups/lib/filter/{rastertogutenprint.5.0,commandtocanon,commandtoepson} \
54 $out/cups/lib/backend/{canon,epson} \
55 $out/sbin/cups-genppd.5.0 \
57 patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
58 --set-rpath $libPath $p
62 ln -s $out/cups/lib $out/lib/cups
66 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
67 description = "Some additional CUPS drivers including Canon drivers";
68 platforms = [ "x86_64-linux" ];