Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchurl 4, fetchpatch 5, autoreconfHook 6, pkg-config 7, help2man 8, python3 9 10, alsa-lib 11, libxslt 12, systemd 13, libusb-compat-0_1 14, libftdi1 15, libICE 16, libSM 17, libX11 18}: 19 20let 21 pythonEnv = python3.pythonForBuild.withPackages (p: with p; [ pyyaml setuptools ]); 22in 23stdenv.mkDerivation rec { 24 pname = "lirc"; 25 version = "0.10.2"; 26 27 src = fetchurl { 28 url = "mirror://sourceforge/lirc/${pname}-${version}.tar.bz2"; 29 sha256 = "sha256-PUTsgnSIHPJi8WCAVkHwgn/8wgreDYXn5vO5Dg09Iio="; 30 }; 31 32 patches = [ 33 # Fix installation of Python bindings 34 (fetchpatch { 35 url = "https://sourceforge.net/p/lirc/tickets/339/attachment/0001-Fix-Python-bindings.patch"; 36 sha256 = "088a39x8c1qd81qwvbiqd6crb2lk777wmrs8rdh1ga06lglyvbly"; 37 }) 38 39 # Add a workaround for linux-headers-5.18 until upstream adapts: 40 # https://sourceforge.net/p/lirc/git/merge-requests/45/ 41 ./linux-headers-5.18.patch 42 ]; 43 44 postPatch = '' 45 patchShebangs . 46 47 # fix overriding PYTHONPATH 48 sed -i 's,^PYTHONPATH *= *,PYTHONPATH := $(PYTHONPATH):,' \ 49 Makefile.in 50 sed -i 's,PYTHONPATH=,PYTHONPATH=$(PYTHONPATH):,' \ 51 doc/Makefile.in 52 53 # Pull fix for new pyyaml pending upstream inclusion 54 # https://sourceforge.net/p/lirc/git/merge-requests/39/ 55 substituteInPlace python-pkg/lirc/database.py --replace 'yaml.load(' 'yaml.safe_load(' 56 57 # cant import '/build/lirc-0.10.1/python-pkg/lirc/_client.so' while cross-compiling to check the version 58 substituteInPlace python-pkg/setup.py \ 59 --replace "VERSION='0.0.0'" "VERSION='${version}'" 60 ''; 61 62 preConfigure = '' 63 # use empty inc file instead of a from linux kernel generated one 64 touch lib/lirc/input_map.inc 65 ''; 66 67 strictDeps = true; 68 69 nativeBuildInputs = [ autoreconfHook help2man libxslt pythonEnv pkg-config ]; 70 71 buildInputs = [ alsa-lib systemd libusb-compat-0_1 libftdi1 libICE libSM libX11 ]; 72 73 DEVINPUT_HEADER = "include/linux/input-event-codes.h"; 74 75 configureFlags = [ 76 "--sysconfdir=/etc" 77 "--localstatedir=/var" 78 "--with-systemdsystemunitdir=$(out)/lib/systemd/system" 79 "--enable-uinput" # explicit activation because build env has no uinput 80 "--enable-devinput" # explicit activation because build env has no /dev/input 81 "--with-lockdir=/run/lirc/lock" # /run/lock is not writable for 'lirc' user 82 "PYTHON=${pythonEnv.interpreter}" 83 ]; 84 85 installFlags = [ 86 "sysconfdir=$out/etc" 87 "localstatedir=$TMPDIR" 88 ]; 89 90 meta = with lib; { 91 description = "Allows to receive and send infrared signals"; 92 homepage = "https://www.lirc.org/"; 93 license = licenses.gpl2; 94 platforms = platforms.linux; 95 maintainers = with maintainers; [ pSub ]; 96 }; 97}