summaryrefslogtreecommitdiffstats
path: root/shared/2configs/shack/muell_caller.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2017-06-01 09:21:20 +0200
committermakefu <github@syntax-fehler.de>2017-06-01 09:22:03 +0200
commit90822f64e0bf247c5cca2f035077553cac5ceb79 (patch)
tree02766f97fbbb88be124ce7056a2258d1a718c722 /shared/2configs/shack/muell_caller.nix
parente086914ce0cbe09a100475149ae9730b58d1222d (diff)
shared: move shack config to shack/
Diffstat (limited to 'shared/2configs/shack/muell_caller.nix')
-rw-r--r--shared/2configs/shack/muell_caller.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/shared/2configs/shack/muell_caller.nix b/shared/2configs/shack/muell_caller.nix
new file mode 100644
index 000000000..613ed2e4f
--- /dev/null
+++ b/shared/2configs/shack/muell_caller.nix
@@ -0,0 +1,41 @@
+{ 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";
+ sha256 = "06xaa1j6sfyvvdxg0366fcslhn478anqh4m5hljyf0z29knvz7pg";
+ };
+ 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.mqtt_sub = {
+ description = "call muell";
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ User = "nobody"; # TODO separate user
+ ExecStartPre = 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";
+ Restart = "always";
+ PrivateTmp = true;
+ PermissionsStartOnly = true;
+ };
+ };
+}