Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook, pkg-config, help2man, python3,
2 alsa-lib, xlibsWrapper, libxslt, systemd, libusb-compat-0_1, libftdi1 }:
3
4stdenv.mkDerivation rec {
5 pname = "lirc";
6 version = "0.10.1";
7
8 src = fetchurl {
9 url = "mirror://sourceforge/lirc/${pname}-${version}.tar.bz2";
10 sha256 = "1whlyifvvc7w04ahq07nnk1h18wc8j7c6wnvlb6mszravxh3qxcb";
11 };
12
13 # Fix installation of Python bindings
14 patches = [ (fetchpatch {
15 url = "https://sourceforge.net/p/lirc/tickets/339/attachment/0001-Fix-Python-bindings.patch";
16 sha256 = "088a39x8c1qd81qwvbiqd6crb2lk777wmrs8rdh1ga06lglyvbly";
17 }) ];
18
19 postPatch = ''
20 patchShebangs .
21
22 # fix overriding PYTHONPATH
23 sed -i 's,^PYTHONPATH *= *,PYTHONPATH := $(PYTHONPATH):,' \
24 Makefile.in
25 sed -i 's,PYTHONPATH=,PYTHONPATH=$(PYTHONPATH):,' \
26 doc/Makefile.in
27 '';
28
29 preConfigure = ''
30 # use empty inc file instead of a from linux kernel generated one
31 touch lib/lirc/input_map.inc
32 '';
33
34 nativeBuildInputs = [ autoreconfHook pkg-config help2man
35 (python3.withPackages (p: with p; [ pyyaml setuptools ])) ];
36
37 buildInputs = [ alsa-lib xlibsWrapper libxslt systemd libusb-compat-0_1 libftdi1 ];
38
39 configureFlags = [
40 "--sysconfdir=/etc"
41 "--localstatedir=/var"
42 "--with-systemdsystemunitdir=$(out)/lib/systemd/system"
43 "--enable-uinput" # explicit activation because build env has no uinput
44 "--enable-devinput" # explicit activation because build env has no /dev/input
45 "--with-lockdir=/run/lirc/lock" # /run/lock is not writable for 'lirc' user
46 ];
47
48 installFlags = [
49 "sysconfdir=$out/etc"
50 "localstatedir=$TMPDIR"
51 ];
52
53 meta = with lib; {
54 description = "Allows to receive and send infrared signals";
55 homepage = "https://www.lirc.org/";
56 license = licenses.gpl2;
57 platforms = platforms.linux;
58 maintainers = with maintainers; [ pSub ];
59 };
60}