lol
1{ stdenv, fetchurl, udev, intltool, pkgconfig, glib, xmlto, wrapGAppsHook
2, makeWrapper, gtk3, docbook_xml_dtd_412, docbook_xsl
3, libxml2, desktop-file-utils, libusb1, cups, gdk_pixbuf, pango, atk, libnotify
4, gobjectIntrospection, libgnome-keyring3
5, cups-filters
6, pythonPackages
7, withGUI ? true
8}:
9
10stdenv.mkDerivation rec {
11 name = "system-config-printer-${version}";
12 version = "1.5.9";
13
14 src = fetchurl {
15 url = "https://github.com/zdohnal/system-config-printer/releases/download/v${version}/${name}.tar.gz";
16 sha256 = "03bwlpsiqpxzcwd78a7rmwiww4jnqd7kl7il4kx78l1r57lasd2r";
17 };
18
19 patches = [ ./detect_serverbindir.patch ];
20
21 buildInputs =
22 [ intltool pkgconfig glib udev libusb1 cups xmlto
23 libxml2 docbook_xml_dtd_412 docbook_xsl desktop-file-utils
24 pythonPackages.python pythonPackages.wrapPython
25 libnotify gobjectIntrospection gdk_pixbuf pango atk
26 libgnome-keyring3
27 ];
28
29 nativeBuildInputs = [ wrapGAppsHook ];
30
31 pythonPath = with pythonPackages; requiredPythonModules [ pycups pycurl dbus-python pygobject3 requests pycairo pysmbc ];
32
33 configureFlags =
34 [ "--with-udev-rules"
35 "--with-udevdir=$(out)/etc/udev"
36 "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
37 ];
38
39 stripDebugList = [ "bin" "lib" "etc/udev" ];
40
41 postInstall =
42 ''
43 buildPythonPath "$out $pythonPath"
44 gappsWrapperArgs+=(
45 --prefix PATH : "$program_PATH"
46 --set CUPS_DATADIR "${cups-filters}/share/cups"
47 )
48
49 find $out/share/system-config-printer -name \*.py -type f -perm -0100 -print0 | while read -d "" f; do
50 patchPythonScript "$f"
51 done
52
53 # The below line will be unneeded when the next upstream release arrives.
54 sed -i -e "s|/usr/local/bin|$out/bin|" "$out/share/dbus-1/services/org.fedoraproject.Config.Printing.service"
55
56 # Manually expand literal "$(out)", which have failed to expand
57 sed -e "s|ExecStart=\$(out)|ExecStart=$out|" \
58 -i "$out/etc/systemd/system/configure-printer@.service"
59 '';
60
61 meta = {
62 homepage = http://cyberelk.net/tim/software/system-config-printer/;
63 platforms = stdenv.lib.platforms.linux;
64 license = stdenv.lib.licenses.gpl2;
65 };
66}