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.
This commit is contained in:
MickaelRoger 2024-09-26 22:13:28 +02:00
parent 44312de8c2
commit 58473a3c1a
2 changed files with 17 additions and 1 deletions

View file

@ -42,6 +42,15 @@ Here, `passwordFile` is the path to a file containing just the password in
plaintext. Make sure to set permissions to make this file unreadable to any plaintext. Make sure to set permissions to make this file unreadable to any
user besides root. 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` By default, the server listen address {option}`services.anki-sync-server.host`
is set to localhost, listening on port is set to localhost, listening on port
{option}`services.anki-sync-server.port`, and does not open the firewall. This {option}`services.anki-sync-server.port`, and does not open the firewall. This

View file

@ -59,6 +59,13 @@ in {
description = "Port number anki-sync-server listens to."; 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 { openFirewall = mkOption {
default = false; default = false;
type = types.bool; type = types.bool;
@ -114,7 +121,7 @@ in {
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
path = [cfg.package]; path = [cfg.package];
environment = { environment = {
SYNC_BASE = "%S/%N"; SYNC_BASE = cfg.baseDirectory;
SYNC_HOST = specEscape cfg.address; SYNC_HOST = specEscape cfg.address;
SYNC_PORT = toString cfg.port; SYNC_PORT = toString cfg.port;
}; };