at 16.09-beta 76 lines 2.7 kB view raw
1{ stdenv, fetchurl, udev, intltool, pkgconfig, glib, xmlto 2, makeWrapper, gtk3, docbook_xml_dtd_412, docbook_xsl 3, libxml2, desktop_file_utils, libusb1, cups, gdk_pixbuf, pango, atk, libnotify 4, cups-filters 5, pythonPackages 6, withGUI ? true 7}: 8 9let majorVersion = "1.5"; 10 11in stdenv.mkDerivation rec { 12 name = "system-config-printer-${majorVersion}.7"; 13 14 src = fetchurl { 15 url = "http://cyberelk.net/tim/data/system-config-printer/${majorVersion}/${name}.tar.xz"; 16 sha256 = "1vxczk22f58nbikvj47s2x1gzh6q4mbgwnf091p00h3b6nxppdgn"; 17 }; 18 19 propagatedBuildInputs = [ pythonPackages.pycurl ]; 20 21 patches = [ ./detect_serverbindir.patch ]; 22 23 buildInputs = 24 [ intltool pkgconfig glib udev libusb1 cups xmlto 25 libxml2 docbook_xml_dtd_412 docbook_xsl desktop_file_utils 26 pythonPackages.python pythonPackages.wrapPython 27 ]; 28 29 pythonPath = with pythonPackages; 30 [ pycups pycurl dbus-python pygobject3 requests2 ]; 31 32 configureFlags = 33 [ "--with-udev-rules" 34 "--with-udevdir=$(out)/etc/udev" 35 "--with-systemdsystemunitdir=$(out)/etc/systemd/system" 36 ]; 37 38 postInstall = 39 let 40 giTypelibPath = stdenv.lib.makeSearchPath "lib/girepository-1.0" [ gdk_pixbuf.out gtk3.out pango.out atk.out libnotify.out ]; 41 in 42 '' 43 export makeWrapperArgs="--set prefix $out \ 44 --set GI_TYPELIB_PATH ${giTypelibPath} \ 45 --set CUPS_DATADIR ${cups-filters}/share/cups" 46 wrapPythonPrograms 47 # The program imports itself, so we need to move shell wrappers to a proper place. 48 fixupWrapper() { 49 mv "$out/share/system-config-printer/$2.py" \ 50 "$out/bin/$1" 51 sed -i "s/.$2.py-wrapped/$2.py/g" "$out/bin/$1" 52 mv "$out/share/system-config-printer/.$2.py-wrapped" \ 53 "$out/share/system-config-printer/$2.py" 54 } 55 fixupWrapper scp-dbus-service scp-dbus-service 56 fixupWrapper system-config-printer system-config-printer 57 fixupWrapper system-config-printer-applet applet 58 # This __init__.py is both executed and imported. 59 ( cd $out/share/system-config-printer/troubleshoot 60 mv .__init__.py-wrapped __init__.py 61 ) 62 63 # The below line will be unneeded when the next upstream release arrives. 64 sed -i -e "s|/usr/bin|$out/bin|" "$out/share/dbus-1/services/org.fedoraproject.Config.Printing.service" 65 66 # Manually expand literal "$(out)", which have failed to expand 67 sed -e "s|ExecStart=\$(out)|ExecStart=$out|" \ 68 -i "$out/etc/systemd/system/configure-printer@.service" 69 ''; 70 71 meta = { 72 homepage = http://cyberelk.net/tim/software/system-config-printer/; 73 platforms = stdenv.lib.platforms.linux; 74 license = stdenv.lib.licenses.gpl2; 75 }; 76}