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

61 lines
1.4 KiB
Nix
Raw Normal View History

2024-09-15 20:58:01 +02:00
{ pkgs, ... }:
2024-09-08 19:14:30 +02:00
let
port = 9090;
2024-09-15 20:58:01 +02:00
scrabbleDirectory = "/var/lib/xanado";
2024-09-08 19:14:30 +02:00
in
{
2024-09-15 20:58:01 +02:00
users.extraUsers.scrabble = {
isSystemUser = true;
group = "scrabble";
home = scrabbleDirectory;
createHome = true;
};
2025-12-28 13:39:42 +01:00
users.extraGroups.scrabble = { };
2024-09-15 20:58:01 +02:00
systemd.services.scrabble = {
2025-12-28 13:39:42 +01:00
wantedBy = [ "multi-user.target" ];
2024-09-15 20:58:01 +02:00
enable = true;
preStart = "npm install @cdot/xanado";
path = [ pkgs.nodejs ];
script = ''
2025-12-28 13:39:42 +01:00
${scrabbleDirectory}/node_modules/.bin/xanado --config ${
(pkgs.formats.json { }).generate "config.json" {
port = port;
host = "localhost";
game_defaults = {
edition = "Deutsch_Scrabble";
dictionary = "German";
};
}
}
2024-09-15 20:58:01 +02:00
'';
serviceConfig = {
User = "scrabble";
Group = "scrabble";
WorkingDirectory = scrabbleDirectory;
2024-09-08 19:14:30 +02:00
};
};
services.nginx.virtualHosts."scrabble.kmein.de" = {
enableACME = true;
forceSSL = true;
locations."/".proxyPass = "http://localhost:${toString port}";
};
2024-09-15 20:58:01 +02:00
systemd.services.scrabble-fix = {
startAt = "hourly";
2025-12-28 13:39:42 +01:00
wantedBy = [ "multi-user.target" ];
2024-09-15 20:58:01 +02:00
enable = false;
script = ''
2025-12-28 13:39:42 +01:00
${pkgs.gnused}/bin/sed -i s/encadefrit/en/ sessions/*.json passwd.json"
2024-09-15 20:58:01 +02:00
'';
serviceConfig = {
User = "scrabble";
Group = "scrabble";
WorkingDirectory = scrabbleDirectory;
};
};
services.restic.backups.niveum.paths = [ scrabbleDirectory ];
2024-09-08 19:14:30 +02:00
}