nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 buildGoModule,
3 avahi,
4 libusb1,
5 pkg-config,
6 lib,
7 fetchFromGitHub,
8 ronn,
9}:
10buildGoModule rec {
11 pname = "ipp-usb";
12 version = "0.9.30";
13
14 src = fetchFromGitHub {
15 owner = "openprinting";
16 repo = "ipp-usb";
17 rev = version;
18 sha256 = "sha256-LcThjiN/MRk4ISWWRT4g/eLvuhzM8pIDAcSlM5us3nQ=";
19 };
20
21 postPatch = ''
22 # rebuild with patched paths
23 rm ipp-usb.8
24 substituteInPlace Makefile \
25 --replace-fail "install: all" "install: man" \
26 --replace-fail "/usr/" "/"
27 substituteInPlace systemd-udev/ipp-usb.service --replace-fail "/sbin" "$out/bin"
28 for i in paths.go ipp-usb.8.md; do
29 substituteInPlace $i --replace-fail "/usr" "$out"
30 substituteInPlace $i --replace-fail "/var/ipp-usb" "/var/lib/ipp-usb"
31 done
32 '';
33
34 nativeBuildInputs = [
35 pkg-config
36 ronn
37 ];
38 buildInputs = [
39 libusb1
40 avahi
41 ];
42
43 vendorHash = null;
44
45 doInstallCheck = true;
46
47 postInstall = ''
48 # to accommodate the makefile
49 cp $out/bin/ipp-usb .
50 make install DESTDIR=$out
51 '';
52
53 meta = {
54 description = "Daemon to use the IPP everywhere protocol with USB printers";
55 mainProgram = "ipp-usb";
56 homepage = "https://github.com/OpenPrinting/ipp-usb";
57 maintainers = [ lib.maintainers.symphorien ];
58 platforms = lib.platforms.linux;
59 license = lib.licenses.bsd2;
60 };
61}