2022-03-10 21:52:12 +01:00
|
|
|
{
|
|
|
|
|
pkgs,
|
|
|
|
|
lib,
|
|
|
|
|
...
|
|
|
|
|
}: let
|
2021-12-30 16:42:02 +01:00
|
|
|
backend = pkgs.callPackage <menstruation-backend> {};
|
|
|
|
|
telegram = pkgs.callPackage <menstruation-telegram> {};
|
2021-10-18 21:14:52 +02:00
|
|
|
backendPort = 8000;
|
2022-03-10 21:52:12 +01:00
|
|
|
in {
|
2022-01-07 17:23:28 +01:00
|
|
|
services.redis.enable = true;
|
2021-10-18 21:14:52 +02:00
|
|
|
|
2022-03-10 21:52:12 +01:00
|
|
|
environment.systemPackages = [pkgs.redis];
|
2022-01-07 17:23:28 +01:00
|
|
|
|
|
|
|
|
systemd.services.menstruation-telegram = {
|
|
|
|
|
wants = [
|
|
|
|
|
"network-online.target"
|
|
|
|
|
"menstruation-backend.service"
|
|
|
|
|
"redis.service"
|
|
|
|
|
];
|
2022-03-10 21:52:12 +01:00
|
|
|
wantedBy = ["multi-user.target"];
|
2022-01-07 17:23:28 +01:00
|
|
|
environment = {
|
|
|
|
|
MENSTRUATION_TOKEN = lib.strings.fileContents <system-secrets/telegram/menstruation.token>;
|
|
|
|
|
MENSTRUATION_ENDPOINT = "http://localhost:${toString backendPort}";
|
|
|
|
|
MENSTRUATION_MODERATORS = "18980945";
|
|
|
|
|
};
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
Restart = "always";
|
|
|
|
|
DynamicUser = true;
|
|
|
|
|
ExecStart = "${telegram}/bin/menstruation-telegram";
|
2021-10-18 21:14:52 +02:00
|
|
|
};
|
2022-01-07 17:23:28 +01:00
|
|
|
};
|
2021-10-18 21:14:52 +02:00
|
|
|
|
2022-01-07 17:23:28 +01:00
|
|
|
systemd.services.menstruation-backend = {
|
2022-03-10 21:52:12 +01:00
|
|
|
wants = ["network-online.target"];
|
2022-01-07 17:23:28 +01:00
|
|
|
environment.ROCKET_PORT = toString backendPort;
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
Restart = "always";
|
|
|
|
|
DynamicUser = true;
|
|
|
|
|
ExecStart = "${backend}/bin/menstruation_server";
|
2021-10-18 21:14:52 +02:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|