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

34 lines
964 B
Nix
Raw Normal View History

{
config,
lib,
pkgs,
...
}: let
2024-07-24 18:47:53 +02:00
inherit (lib.meta) getExe';
in {
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 = "${getExe' pkgs.anki-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
'';
};
}