1{ buildGoModule, avahi, libusb1, pkg-config, lib, fetchFromGitHub, ronn }:
2buildGoModule rec {
3 pname = "ipp-usb";
4 version = "0.9.25";
5
6 src = fetchFromGitHub {
7 owner = "openprinting";
8 repo = "ipp-usb";
9 rev = version;
10 sha256 = "sha256-ryKQDzb31JA192lbCYkwJrXgwErViqIzP4mD2NmWdgA=";
11 };
12
13 postPatch = ''
14 # rebuild with patched paths
15 rm ipp-usb.8
16 substituteInPlace Makefile --replace "install: all" "install: man"
17 substituteInPlace systemd-udev/ipp-usb.service --replace "/sbin" "$out/bin"
18 for i in Makefile paths.go ipp-usb.8.md; do
19 substituteInPlace $i --replace "/usr" "$out"
20 substituteInPlace $i --replace "/var/ipp-usb" "/var/lib/ipp-usb"
21 done
22 '';
23
24 nativeBuildInputs = [ pkg-config ronn ];
25 buildInputs = [ libusb1 avahi ];
26
27 vendorHash = "sha256-61vCER1yR70Pn+CrfTai1sgiQQLU6msb9jxushus5W4=";
28
29 postInstall = ''
30 # to accomodate the makefile
31 cp $out/bin/ipp-usb .
32 make install DESTDIR=$out
33 '';
34
35 meta = {
36 description = "Daemon to use the IPP everywhere protocol with USB printers";
37 mainProgram = "ipp-usb";
38 homepage = "https://github.com/OpenPrinting/ipp-usb";
39 maintainers = [ lib.maintainers.symphorien ];
40 platforms = lib.platforms.linux;
41 license = lib.licenses.bsd2;
42 };
43}