niksos/hosts/chmura/services/anki-sync-server.nix

31 lines
910 B
Nix
Raw Normal View History

{
config,
pkgs,
...
}: {
2024-05-03 18:51:48 +02:00
age.secrets.anki-user-credentials.file = ../../../secrets/anki-user-credentials.age;
systemd.services.anki-sync-server = {
description = "Selfhosted Anki sync server.";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
DynamicUser = true;
StateDirectory = "anki-sync-server";
ExecStart = "${pkgs.anki-bin}/bin/anki --syncserver";
Environment = ''SYNC_BASE="/var/lib/anki-sync-server" SYNC_HOST="127.0.0.1" SYNC_PORT="27701"'';
EnvironmentFile = config.age.secrets.anki-user-credentials.path;
Restart = "always";
};
};
services.caddy = {
enable = true;
virtualHosts."a.jacekpoz.pl".extraConfig = ''
reverse_proxy * localhost:27701
'';
};
}