{ 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 ''; }; }