1{ stdenv, fetchurl, perl }:
2
3stdenv.mkDerivation rec {
4 name = "triggerhappy-${version}";
5 version = "0.5.0";
6
7 src = fetchurl {
8 url = "https://github.com/wertarbyte/triggerhappy/archive/release/${version}.tar.gz";
9 sha256 = "af0fc196202f2d35153be401769a9ad9107b5b6387146cfa8895ae9cafad631c";
10 };
11
12 buildInputs = [ perl ];
13 installFlags = [ "DESTDIR=$(out)" ];
14
15 postPatch = ''
16 substituteInPlace Makefile --replace "/usr/" "/"
17 substituteInPlace Makefile --replace "/sbin/" "/bin/"
18 '';
19
20 postInstall = ''
21 install -D -m 644 -t "$out/etc/triggerhappy/triggers.d" "triggerhappy.conf.examples"
22 install -D -m 644 -t "$out/usr/lib/systemd/system" "systemd/triggerhappy.service" "systemd/triggerhappy.socket"
23 install -D -m 644 -t "$out/usr/lib/udev/rules.d" "udev/triggerhappy-udev.rules"
24 '';
25
26 meta = with stdenv.lib; {
27 description = "A lightweight hotkey daemon";
28 longDescription = ''
29 Triggerhappy is a hotkey daemon developed with small and embedded systems in
30 mind, e.g. linux based routers. It attaches to the input device files and
31 interprets the event data received and executes scripts configured in its
32 configuration.
33 '';
34 homepage = https://github.com/wertarbyte/triggerhappy/;
35 license = licenses.gpl3Plus;
36 platforms = platforms.linux;
37 maintainers = [ maintainers.taha ];
38 };
39}