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

scrabble: host without containers

This commit is contained in:
2024-09-15 20:58:01 +02:00
parent 4b96e82d25
commit dacf34ebc0

View File

@@ -1,20 +1,59 @@
{ pkgs, ... }:
let
port = 9090;
scrabbleDirectory = "/var/lib/xanado";
in
{
virtualisation.oci-containers = {
backend = "podman";
containers.xanado = {
volumes = [ ];
ports = [ "${toString port}:9093" ];
environment.TZ = "Europe/Berlin";
image = "ghcr.io/cdot/xanado:v3.1.6";
users.extraUsers.scrabble = {
isSystemUser = true;
group = "scrabble";
home = scrabbleDirectory;
createHome = true;
};
users.extraGroups.scrabble = {};
systemd.services.scrabble = {
wantedBy = ["multi-user.target"];
enable = true;
preStart = "npm install @cdot/xanado";
path = [ pkgs.nodejs ];
script = ''
${scrabbleDirectory}/node_modules/.bin/xanado --config ${(pkgs.formats.json {}).generate "config.json" {
port = port;
host = "localhost";
game_defaults = {
edition = "Deutsch_Scrabble";
dictionary = "German";
};
}}
'';
serviceConfig = {
User = "scrabble";
Group = "scrabble";
WorkingDirectory = scrabbleDirectory;
};
};
services.nginx.virtualHosts."scrabble.kmein.de" = {
enableACME = true;
forceSSL = true;
locations."/".proxyPass = "http://localhost:${toString port}";
};
systemd.services.scrabble-fix = {
startAt = "hourly";
wantedBy = ["multi-user.target"];
enable = false;
script = ''
${pkgs.gnused}/bin/sed -i s/encadefrit/en/ sessions/*.json passwd.json"
'';
serviceConfig = {
User = "scrabble";
Group = "scrabble";
WorkingDirectory = scrabbleDirectory;
};
};
services.restic.backups.niveum.paths = [ scrabbleDirectory ];
}