maintainers: remove email for amuckstot30 (#360059)
[NixPkgs.git] / pkgs / os-specific / linux / usbrelay / daemon.nix
blob6e4e4661fd53ad5fbf424d4939fe4872c3cfd801
1 { stdenv, usbrelay, python3, installShellFiles }:
2 let
3   python = python3.withPackages (ps: with ps; [ usbrelay-py paho-mqtt ]);
4 in
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).
8 stdenv.mkDerivation {
9   pname = "usbrelayd";
11   inherit (usbrelay) src version;
13   postPatch = ''
14     substituteInPlace 'usbrelayd.service' \
15       --replace '/usr/bin/python3' "${python}/bin/python3" \
16       --replace '/usr/sbin/usbrelayd' "$out/bin/usbrelayd"
17   '';
19   nativeBuildInputs = [ installShellFiles ];
21   buildInputs = [ python ];
23   dontBuild = true;
25   installPhase = ''
26     runHook preInstall;
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
32     runHook postInstall
33   '';
35   meta = {
36     description = "USB Relay MQTT service";
37     inherit (usbrelay.meta) homepage license maintainers platforms;
38   };