33 lines
959 B
Nix
33 lines
959 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
inherit (lib) getExe';
|
|
in {
|
|
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
|
|
'';
|
|
};
|
|
}
|