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

43 lines
1.1 KiB
Nix
Raw Normal View History

2017-06-01 07:21:20 +00:00
{ config, lib, pkgs, ... }:
with import <stockholm/lib>;
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 = "${toString <secrets>}/tell.json";
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
};
};
}