1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/systems/makanek/menstruation.nix

63 lines
1.5 KiB
Nix
Raw Permalink Normal View History

2022-03-10 21:52:12 +01:00
{
config,
2022-03-10 21:52:12 +01:00
pkgs,
lib,
2022-03-10 21:52:12 +01:00
...
2025-12-27 22:22:54 +01:00
}:
let
2021-10-18 21:14:52 +02:00
backendPort = 8000;
2025-12-27 22:22:54 +01:00
in
{
2022-07-19 21:33:45 +02:00
services.redis.servers.menstruation = {
enable = true;
port = 6379;
};
2021-10-18 21:14:52 +02:00
2025-12-27 22:22:54 +01:00
environment.systemPackages = [ pkgs.redis ];
2022-01-07 17:23:28 +01:00
2022-05-22 11:47:59 +02:00
niveum.passport.services = [
{
title = "Tischlein, deck dich!";
description = "serves you with Berlin canteen menus via Telegram.";
link = "https://t.me/TischleinDeckDichBot";
}
];
2022-01-07 17:23:28 +01:00
systemd.services.menstruation-telegram = {
wants = [
"network-online.target"
"menstruation-backend.service"
2022-07-19 21:33:45 +02:00
"redis-menstruation.service"
2022-01-07 17:23:28 +01:00
];
2025-12-27 22:22:54 +01:00
wantedBy = [ "multi-user.target" ];
2022-01-07 17:23:28 +01:00
environment = {
MENSTRUATION_ENDPOINT = "http://localhost:${toString backendPort}";
MENSTRUATION_MODERATORS = "18980945";
};
script = ''
set -efu
export MENSTRUATION_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/menstruation-token")"
2025-12-28 13:19:15 +01:00
${pkgs.menstruation-telegram}/bin/menstruation-telegram
'';
2022-01-07 17:23:28 +01:00
serviceConfig = {
Restart = "always";
DynamicUser = true;
LoadCredential = [
"menstruation-token:${config.age.secrets.telegram-token-menstruation.path}"
];
2021-10-18 21:14:52 +02:00
};
2022-01-07 17:23:28 +01:00
};
2021-10-18 21:14:52 +02:00
age.secrets.telegram-token-menstruation.file = ../../secrets/telegram-token-menstruation.age;
2022-01-07 17:23:28 +01:00
systemd.services.menstruation-backend = {
2025-12-27 22:22:54 +01:00
wants = [ "network-online.target" ];
2022-01-07 17:23:28 +01:00
environment.ROCKET_PORT = toString backendPort;
serviceConfig = {
Restart = "always";
DynamicUser = true;
2025-12-28 13:19:15 +01:00
ExecStart = "${pkgs.menstruation-backend}/bin/menstruation_server";
2021-10-18 21:14:52 +02:00
};
};
}