blob: f3007dd1dba83ca501020987d9d444d14b52cb81 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
{ config, lib, pkgs, ... }:
with import ../../../lib/pure.nix { inherit 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";
};
buildInputs = [
(pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
docopt
requests
paramiko
python
]))
];
installPhase = ''
install -m755 -D call.py $out/bin/call-muell
'';
};
cfg = "${toString <secrets>}/tell.json";
in {
systemd.services.call_muell = {
description = "call muell";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "nobody"; # TODO separate user
ExecStartPre = pkgs.writeDash "call-muell-pre" ''
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;
Restart = "always";
RestartSec = "15";
};
};
}
|