greenmask: 0.2.6 -> 0.2.7 (#378403)
[NixPkgs.git] / pkgs / tools / misc / system-config-printer / default.nix
blobaa1d78d7658da4379a1774bbb2ee0036525d91a6
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   udev,
6   pkg-config,
7   glib,
8   xmlto,
9   wrapGAppsHook3,
10   docbook_xml_dtd_412,
11   docbook_xsl,
12   libxml2,
13   desktop-file-utils,
14   libusb1,
15   cups,
16   gdk-pixbuf,
17   pango,
18   atk,
19   libnotify,
20   gobject-introspection,
21   libsecret,
22   packagekit,
23   libcupsfilters,
24   gettext,
25   libtool,
26   autoconf-archive,
27   python3Packages,
28   autoreconfHook,
29   bash,
30   fetchpatch,
33 stdenv.mkDerivation rec {
34   pname = "system-config-printer";
35   version = "1.5.18";
37   src = fetchFromGitHub {
38     owner = "openPrinting";
39     repo = pname;
40     rev = "v${version}";
41     sha256 = "sha256-l3HEnYycP56vZWREWkAyHmcFgtu09dy4Ds65u7eqNZk=";
42   };
44   prePatch = ''
45     # for automake
46     touch README ChangeLog
47     # for tests
48     substituteInPlace Makefile.am --replace /bin/bash ${bash}/bin/bash
49   '';
51   patches = [
52     ./detect_serverbindir.patch
53     # fix typeerror, remove on next release
54     (fetchpatch {
55       url = "https://github.com/OpenPrinting/system-config-printer/commit/399b3334d6519639cfe7f1c0457e2475b8ee5230.patch";
56       sha256 = "sha256-JCdGmZk2vRn3X1BDxOJaY3Aw8dr0ODVzi0oY20ZWfRs=";
57       excludes = [ "NEWS" ];
58     })
60     # switch to pep517 build tools
61     ./pep517.patch
62   ];
64   buildInputs = [
65     glib
66     udev
67     libusb1
68     cups
69     python3Packages.python
70     libnotify
71     gdk-pixbuf
72     pango
73     atk
74     packagekit
75     libsecret
76   ];
78   nativeBuildInputs = [
79     pkg-config
80     gettext
81     libtool
82     autoconf-archive
83     xmlto
84     libxml2
85     docbook_xml_dtd_412
86     docbook_xsl
87     desktop-file-utils
88     python3Packages.wrapPython
89     python3Packages.build
90     python3Packages.installer
91     python3Packages.setuptools
92     python3Packages.wheel
93     wrapGAppsHook3
94     autoreconfHook
95     gobject-introspection
96   ];
98   pythonPath =
99     with python3Packages;
100     requiredPythonModules [
101       pycups
102       pycurl
103       dbus-python
104       pygobject3
105       pycairo
106       pysmbc
107     ];
109   configureFlags = [
110     "--with-udev-rules"
111     "--with-udevdir=${placeholder "out"}/etc/udev"
112     "--with-systemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
113   ];
115   stripDebugList = [
116     "bin"
117     "lib"
118     "etc/udev"
119   ];
121   doCheck = true;
123   postInstall = ''
124     buildPythonPath "$out $pythonPath"
125     gappsWrapperArgs+=(
126       --prefix PATH : "$program_PATH"
127       --set CUPS_DATADIR "${libcupsfilters}/share/cups"
128     )
130     find $out/share/system-config-printer -name \*.py -type f -perm -0100 -print0 | while read -d "" f; do
131       patchPythonScript "$f"
132     done
133     patchPythonScript $out/etc/udev/udev-add-printer
135     substituteInPlace $out/etc/udev/rules.d/70-printers.rules \
136       --replace "udev-configure-printer" "$out/etc/udev/udev-configure-printer"
137   '';
139   meta = {
140     homepage = "https://github.com/openprinting/system-config-printer";
141     platforms = lib.platforms.linux;
142     license = lib.licenses.gpl2Plus;
143   };