summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/deployment/events-publisher
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2018-08-21 19:52:30 +0200
committerjeschli <jeschli@gmail.com>2018-08-21 19:52:30 +0200
commit8cfc4f5eda10b1025a4ad3b9725deb9ad7a32338 (patch)
tree4a9626e685bc076461f5e63c55e29e3689d2eedd /makefu/2configs/deployment/events-publisher
parentf2dadea808323f69531c51b12ed5cb872ac933a0 (diff)
parent89951ebd816248bc4e62b2dad78b5db906c3cefe (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'makefu/2configs/deployment/events-publisher')
-rw-r--r--makefu/2configs/deployment/events-publisher/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/makefu/2configs/deployment/events-publisher/default.nix b/makefu/2configs/deployment/events-publisher/default.nix
new file mode 100644
index 000000000..c671b1a0b
--- /dev/null
+++ b/makefu/2configs/deployment/events-publisher/default.nix
@@ -0,0 +1,48 @@
+{ pkgs, ... }:
+with import <stockholm/lib>;
+let
+ shack-announce = pkgs.callPackage (builtins.fetchTarball {
+ url = "https://github.com/makefu/events-publisher/archive/5e7b083c63f25182a02c1fddb3d32cb9534fbc50.tar.gz";
+ sha256 = "1zzlhyj8fr6y3a3b6qlyrm474xxxs1ydqjpkd2jva3g1lnzlmvkp";
+ }) {} ;
+ home = "/var/lib/shackannounce";
+ user = "shackannounce";
+ creds = (toString <secrets>) + "/shack-announce.json";
+in
+{
+ users.users.${user}= {
+ uid = genid user;
+ inherit home;
+ createHome = true;
+ };
+ systemd.services.shack-announce = {
+ description = "Announce shack events";
+ startAt = "*:0/30";
+ path = [ shack-announce ];
+ serviceConfig = {
+ WorkingDirectory = home;
+ User = user;
+ PermissionsStartOnly = true;
+ ExecStartPre = pkgs.writeDash "shack-announce-pre" ''
+ set -eu
+ cp ${creds} creds.json
+ chown ${user} creds.json
+ '';
+ ExecStart = pkgs.writeDash "shack-announce" ''
+ if test ! -e announce.state; then
+ echo "initializing state"
+ announce-daemon \
+ --lol INFO \
+ --creds creds.json \
+ --state announce.state \
+ --clean --init
+ fi
+ echo "Running announce"
+ announce-daemon \
+ --lol INFO \
+ --creds creds.json \
+ --state announce.state
+ '';
+ };
+ };
+}