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

42 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 = "bbd4009";
2017-06-01 08:13:14 +00:00
sha256 = "1bfnfl2vdh0p5wzyz5p48qh04vvsg2445avg86fzhzragx25fqv0";
2017-06-01 07:21:20 +00:00
};
buildInputs = [
(pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
docopt
2017-06-01 08:13:14 +00:00
requests2
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";
Restart = "always";
PrivateTmp = true;
PermissionsStartOnly = true;
};
};
}