From 8ff2647169d4add5cfaf139f80ee805fec9df1aa Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Thu, 27 Aug 2009 23:32:13 +0000 Subject: [PATCH] adding gutenprint (former gimp-print) and gutenprintBin. I still haven't found the source of the binary package containing the .ppd files Still impure but works. See comment. svn path=/nixpkgs/trunk/; revision=16881 --- pkgs/applications/graphics/gimp/default.nix | 2 + pkgs/misc/drivers/gutenprint/bin.nix | 61 +++++++++++++++++++ pkgs/misc/drivers/gutenprint/default.nix | 67 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 9 +++ 4 files changed, 139 insertions(+) create mode 100644 pkgs/misc/drivers/gutenprint/bin.nix create mode 100644 pkgs/misc/drivers/gutenprint/default.nix diff --git a/pkgs/applications/graphics/gimp/default.nix b/pkgs/applications/graphics/gimp/default.nix index d16cb03af033..31e8ce58de0f 100644 --- a/pkgs/applications/graphics/gimp/default.nix +++ b/pkgs/applications/graphics/gimp/default.nix @@ -17,6 +17,8 @@ stdenv.mkDerivation { perlXMLParser python pygtk gettext intltool babl gegl ]; + passthru = { inherit gtk; }; # probably its a good idea to use the same gtk in plugins ? + configureFlags = [ "--disable-print" ]; # "screenshot" needs this. diff --git a/pkgs/misc/drivers/gutenprint/bin.nix b/pkgs/misc/drivers/gutenprint/bin.nix new file mode 100644 index 000000000000..a91ca10d8ca1 --- /dev/null +++ b/pkgs/misc/drivers/gutenprint/bin.nix @@ -0,0 +1,61 @@ +args: with args; + +/* usage: (sorry, its still impure but works!) + +impure directory: +mkdir /opt/gutenprint; sudo cp -r $(nix-build -A gutenprintBin -f $NIXPGS_ALL) /opt/gutenprint + +add the following lines to bindirCmds property of printing/cupsd.nix: + + ln -s ${pkgs.gutenprintBin}/lib/cups/backend/* $out/lib/cups/backend/ + ln -s ${pkgs.gutenprintBin}/lib/cups/filter/* $out/lib/cups/filter/ + ensureDir $out/lib/cups/model + 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 + sed -i 's@/opt/gutenprint/cups@${pkgs.gutenprintBin}/cups@' $out/lib/cups/model/Canon-PIXMA_iP4000-gutenprint.5.0.sim-en.ppd + +Then rebuild your system and add your printer using the the localhost:603 cups web interface +select the extracted .ppd file which can be found in the model directory of +sed -n 's/^ServerBin //p' $(sed -n 's/respawn.*-c \(.*''\) -F.*''/\1/p' /etc/event.d/cupsd) +(sorry, cups still doesn't see it. You could copy it into /nix/store/ +*-cups/lib/cups/model/ and you would be able to select canon -> PIXMA 4000 +then. I've tried that. + +TODO tidy this all up. Find source instead of binary. Fix paths ... Find out how to check ink levels etc + +*/ +stdenv.mkDerivation { + name = "cups-gutenprint-binary-5.0.1"; + + src = if stdenv.system == "x86_64-linux" then fetchurl { + url = http://www.openprinting.org/download/printdriver/debian/dists/lsb3.1/main/binary-amd64/gutenprint_5.0.1-1lsb3.1_amd64.deb; + sha256 = "0an5gba6r6v54r53s2gj2fjk8fzpl4lrksjas2333528b0k8gbbc"; + } else throw "TODO"; # get from openprint.com -> drivers -> gutenprint + + buildInputs = [ rpm cpio ]; + + phases = "buildPhase"; + + libPath = stdenv.lib.makeLibraryPath [ stdenv.gcc.gcc zlib ]; + + buildPhase = '' + ar -x $src data.tar.gz + tar xfz data.tar.gz + cp -r opt/gutenprint $out + + for p in \ + $out/cups/lib/driver/gutenprint.5.0 \ + $out/bin/{escputil,cups-calibrate} \ + $out/cups/lib/driver/gutenprint.5.0 \ + $out/cups/lib/filter/{rastertogutenprint.5.0,commandtocanon,commandtoepson} \ + $out/cups/lib/backend/{canon,epson} \ + $out/sbin/cups-genppd.5.0 \ + ; do + patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \ + --set-rpath $libPath $p + done + ''; + + meta = { + description = "some additional drivers including canon printer drivers"; + }; +} diff --git a/pkgs/misc/drivers/gutenprint/default.nix b/pkgs/misc/drivers/gutenprint/default.nix new file mode 100644 index 000000000000..54a61749f9aa --- /dev/null +++ b/pkgs/misc/drivers/gutenprint/default.nix @@ -0,0 +1,67 @@ +# this package was called gimp-print in the past +args: with args; +let inherit (args.composableDerivation) composableDerivation edf wwf; in +composableDerivation {} { + + + name = "gutenprint-drivers"; + + src = fetchurl { + url = mirror://sourceforge/gimp-print/files/gutenprint-5.2/5.2.4/gutenprint-5.2.4.tar.bz2; + sha256 = "09lnmf92h51sm0hmzd1hn2kl1sh6dxlnc0zjd9lrifzg0miyh45n"; + }; + + # gimp, gui is still not working (TODO) + buildInputs = [ openssl pkgconfig]; + + configureFlags = ["--enable-static-genppd"]; + #preConfigure = '' + # configureFlags="--with-cups=$out/usr-cups $configureFlags" + #''; + /* + is this recommended? without it this warning is printed: + + ***WARNING: Use of --disable-static-genppd or --disable-static + when building CUPS is very dangerous. The build may + fail when building the PPD files, or may *SILENTLY* + build incorrect PPD files or cause other problems. + Please review the README and release notes carefully! + */ + + installPhase = '' + eval "make install $installArgs" + ''; + + meta = { + description = "Ghostscript and cups printer drivers"; + homepage = http://sourceforge.net/projects/gimp-print/; + license = "GPL"; + }; + + mergeAttrBy = { installArgs = lib.concat; }; + + # most interpreters aren't tested yet.. (see python for example how to do it) + flags = + wwf { + name = "gimp2"; + enable = { + buildInputs = [gimp gimp.gtk]; + installArgs = [ "gimp2_plug_indir=$out/${gimp.name}-plugins" ]; + }; + } + // { + cups = { + set = { + buildInputs = [cups libtiff libpng ]; + installArgs = [ "cups_conf_datadir=$out cups_conf_serverbin=$out cups_conf_serverroot=$out"]; + }; + }; + } + ; + + cfg = { + gimp2Support = true; + cupsSupport = true; + }; + +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 81ca13756edf..d83ff3a21f0d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7882,6 +7882,15 @@ let inherit fetchurl stdenv zlib libjpeg libpng libtiff pam openssl; }; + gutenprint = import ../misc/drivers/gutenprint { + inherit fetchurl stdenv lib pkgconfig composableDerivation cups libtiff libpng + openssl git gimp; + }; + + gutenprintBin = import ../misc/drivers/gutenprint/bin.nix { + inherit fetchurl stdenv rpm cpio zlib; + }; + cupsBjnp = import ../misc/cups/drivers/cups-bnjp { inherit fetchurl stdenv cups; };