nixos/anki-sync-server: add setting

There is no option to specify where the anki-sync-server data will be stored. This commit adds this option.

Changed files
+17 -1
nixos
+9
nixos/modules/services/misc/anki-sync-server.md
···
plaintext. Make sure to set permissions to make this file unreadable to any
user besides root.
+
By default, synced data are stored in */var/lib/anki-sync-server/*ankiuser**.
+
You can change the directory by using `services.anki-sync-server.baseDirectory`
+
+
```nix
+
{
+
services.anki-sync-server.baseDirectory = "/home/anki/data";
+
}
+
```
+
By default, the server listen address {option}`services.anki-sync-server.host`
is set to localhost, listening on port
{option}`services.anki-sync-server.port`, and does not open the firewall. This
+8 -1
nixos/modules/services/misc/anki-sync-server.nix
···
description = "Port number anki-sync-server listens to.";
};
+
baseDirectory = mkOption {
+
type = types.str;
+
default = "%S/%N";
+
description = "Base directory where user(s) synchronized data will be stored.";
+
};
+
+
openFirewall = mkOption {
default = false;
type = types.bool;
···
wantedBy = ["multi-user.target"];
path = [cfg.package];
environment = {
-
SYNC_BASE = "%S/%N";
+
SYNC_BASE = cfg.baseDirectory;
SYNC_HOST = specEscape cfg.address;
SYNC_PORT = toString cfg.port;
};