1 { stdenv, usbrelay, python3, installShellFiles }:
3 python = python3.withPackages (ps: with ps; [ usbrelay-py paho-mqtt ]);
5 # This is a separate derivation, not just an additional output of
6 # usbrelay, because otherwise, we have a cyclic dependency between
7 # usbrelay (default.nix) and the python module (python.nix).
11 inherit (usbrelay) src version;
14 substituteInPlace 'usbrelayd.service' \
15 --replace '/usr/bin/python3' "${python}/bin/python3" \
16 --replace '/usr/sbin/usbrelayd' "$out/bin/usbrelayd"
19 nativeBuildInputs = [ installShellFiles ];
21 buildInputs = [ python ];
27 install -m 644 -D usbrelayd $out/bin/usbrelayd
28 install -m 644 -D usbrelayd.service $out/lib/systemd/system/usbrelayd.service
29 install -m 644 -D 50-usbrelay.rules $out/lib/udev/rules.d/50-usbrelay.rules
30 install -m 644 -D usbrelayd.conf $out/etc/usbrelayd.conf # include this as an example
31 installManPage usbrelayd.8
36 description = "USB Relay MQTT service";
37 inherit (usbrelay.meta) homepage license maintainers platforms;