niksos/hosts/chmura/anki-sync-server.nix
jacekpoz 826d63c832
feat: swap unmaintained anki sync server
the ankisyncd is dead. long live the anki-sync-server!
2023-09-13 20:23:38 +02:00

30 lines
907 B
Nix

{
config,
pkgs,
...
}: {
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
'';
};
}