From ac54cd5eafe8a6dce167a762d2f48208aae489cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Mon, 18 Oct 2021 21:14:52 +0200 Subject: [PATCH] feat(makanek): run mensa bot --- configs/menstruation.nix | 41 +++++++++++++++++++++++++++++++ submodules/menstruation-telegram | 2 +- systems/makanek/configuration.nix | 1 + 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 configs/menstruation.nix diff --git a/configs/menstruation.nix b/configs/menstruation.nix new file mode 100644 index 0000000..8eb8435 --- /dev/null +++ b/configs/menstruation.nix @@ -0,0 +1,41 @@ +{ pkgs, lib, ... }: +let + backend = pkgs.callPackage {}; + telegram = pkgs.callPackage {}; + backendPort = 8000; +in +{ + containers.menstruation.autoStart = true; + containers.menstruation.config = { config, pkgs, ... }: { + services.redis.enable = true; + + systemd.services.menstruation-telegram = { + wants = [ + "network-online.target" + "menstruation-backend.service" + "redis.service" + ]; + wantedBy = [ "multi-user.target" ]; + environment = { + MENSTRUATION_TOKEN = lib.strings.fileContents ; + MENSTRUATION_ENDPOINT = "http://localhost:${toString backendPort}"; + MENSTRUATION_MODERATORS = "18980945"; + }; + serviceConfig = { + Restart = "always"; + DynamicUser = true; + ExecStart = "${telegram}/bin/menstruation-telegram"; + }; + }; + + systemd.services.menstruation-backend = { + wants = [ "network-online.target" ]; + environment.ROCKET_PORT = toString backendPort; + serviceConfig = { + Restart = "always"; + DynamicUser = true; + ExecStart = "${backend}/bin/menstruation_server"; + }; + }; + }; +} diff --git a/submodules/menstruation-telegram b/submodules/menstruation-telegram index 3eab0f8..d941ccb 160000 --- a/submodules/menstruation-telegram +++ b/submodules/menstruation-telegram @@ -1 +1 @@ -Subproject commit 3eab0f8e4c96f42350a70f425a12c0a31b5800fd +Subproject commit d941ccb4c1aa3874d099f77eebd790ffc4767002 diff --git a/systems/makanek/configuration.nix b/systems/makanek/configuration.nix index 68368e0..a7bf61d 100644 --- a/systems/makanek/configuration.nix +++ b/systems/makanek/configuration.nix @@ -59,6 +59,7 @@ in +