stockholm/krebs/2configs/shack/muell_caller.nix

43 lines
1.2 KiB
Nix
Raw Normal View History

2017-06-01 07:21:20 +00:00
{ config, lib, pkgs, ... }:
2023-06-10 10:50:53 +00:00
with import ../../../lib/pure.nix { inherit lib; };
2017-06-01 07:21:20 +00:00
let
pkg = pkgs.stdenv.mkDerivation {
name = "muell_caller-2017-06-01";
src = pkgs.fetchgit {
url = "https://github.com/shackspace/muell_caller/";
rev = "ee4e499";
sha256 = "0q1v07q633sbqg4wkgf0zya2bnqrikpyjhzp05iwn2vcs8rvsi3k";
2017-06-01 07:21:20 +00:00
};
buildInputs = [
(pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
docopt
2017-08-26 18:03:57 +00:00
requests
2017-06-01 07:21:20 +00:00
paramiko
python
]))
];
installPhase = ''
install -m755 -D call.py $out/bin/call-muell
'';
};
cfg = "${config.krebs.secret.directory}/tell.json";
2017-06-01 07:21:20 +00:00
in {
2017-06-01 08:13:14 +00:00
systemd.services.call_muell = {
2017-06-01 07:21:20 +00:00
description = "call muell";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "nobody"; # TODO separate user
2017-06-01 08:13:14 +00:00
ExecStartPre = pkgs.writeDash "call-muell-pre" ''
2017-06-01 07:21:20 +00:00
cp ${cfg} /tmp/tell.json
chown nobody /tmp/tell.json
'';
ExecStart = "${pkg}/bin/call-muell --cfg /tmp/tell.json --mode mpd loop 60";
PrivateTmp = true;
PermissionsStartOnly = true;
2019-09-26 19:46:14 +00:00
Restart = "always";
RestartSec = "15";
2017-06-01 07:21:20 +00:00
};
};
}