diff options
| author | Martin Fischer <martin@push-f.com> | 2026-02-28 18:45:22 +0100 |
|---|---|---|
| committer | Martin Fischer <martin@push-f.com> | 2026-03-02 08:30:58 +0100 |
| commit | 6268d1328e3d73d208656f4f6b984681f91da9f9 (patch) | |
| tree | 98753887f0dc47717f352e2ef3ed5c0633899e05 /nixos | |
| parent | 5bf0183630b04a58c2234350f35bfbf8772856b6 (diff) | |
feat(ev): add anki-sync-server
Diffstat (limited to 'nixos')
| -rw-r--r-- | nixos/hosts/ev/default.nix | 18 | ||||
| -rw-r--r-- | nixos/hosts/ev/patches/anki-sync-server-delete-exclusive-lock.patch | 12 | ||||
| -rw-r--r-- | nixos/hosts/ev/ports.nix | 1 | ||||
| -rw-r--r-- | nixos/hosts/ev/secrets/anki-sync-server-martin.age | 8 |
4 files changed, 39 insertions, 0 deletions
diff --git a/nixos/hosts/ev/default.nix b/nixos/hosts/ev/default.nix index 3c5eb43..29e0ffd 100644 --- a/nixos/hosts/ev/default.nix +++ b/nixos/hosts/ev/default.nix @@ -145,6 +145,23 @@ in }; }; + age.secrets.anki-sync-server-martin.file = ./secrets/anki-sync-server-martin.age; + services.anki-sync-server = { + enable = true; + package = pkgs.anki-sync-server.overrideAttrs (old: { + patches = old.patches ++ [ + # Patch to remove locking_mode=exclusive (see https://forums.ankiweb.net/t/69051). + ./patches/anki-sync-server-delete-exclusive-lock.patch + ]; + }); + port = ports.ankiSyncServer; + address = "0.0.0.0"; + users = [ + # Also add a restic-database-backups.sqliteDatabases attr for each user. + { username = "martin"; passwordFile = config.age.secrets.anki-sync-server-martin.path; } + ]; + }; + exerciseLog = { enable = true; port = ports.exerciseLog; @@ -224,6 +241,7 @@ in "miniflux" ]; sqliteDatabases = { + anki-martin = "/var/lib/anki-sync-server/martin/collection.anki2"; exercise-log = "/var/lib/exercise-log/database.sqlite"; navidrome = "/var/lib/navidrome/navidrome.db"; }; diff --git a/nixos/hosts/ev/patches/anki-sync-server-delete-exclusive-lock.patch b/nixos/hosts/ev/patches/anki-sync-server-delete-exclusive-lock.patch new file mode 100644 index 0000000..fdb8990 --- /dev/null +++ b/nixos/hosts/ev/patches/anki-sync-server-delete-exclusive-lock.patch @@ -0,0 +1,12 @@ +diff --git a/rslib/src/storage/sqlite.rs b/rslib/src/storage/sqlite.rs +index 7f68496b4..e8f711941 100644 +--- a/rslib/src/storage/sqlite.rs ++++ b/rslib/src/storage/sqlite.rs +@@ -62,7 +62,6 @@ fn open_or_create_collection_db(path: &Path) -> Result<Connection> { + + db.busy_timeout(std::time::Duration::from_secs(0))?; + +- db.pragma_update(None, "locking_mode", "exclusive")?; + db.pragma_update(None, "page_size", 4096)?; + db.pragma_update(None, "cache_size", -40 * 1024)?; + db.pragma_update(None, "legacy_file_format", false)?; diff --git a/nixos/hosts/ev/ports.nix b/nixos/hosts/ev/ports.nix index 54489c6..4410676 100644 --- a/nixos/hosts/ev/ports.nix +++ b/nixos/hosts/ev/ports.nix @@ -6,6 +6,7 @@ rec { navidrome = 4002; actual = 4003; exerciseLog = 4004; + ankiSyncServer = 4005; prometheus = 9090; prometheusNodeExporter = 9002; prometheusSqlExporter = 9003; diff --git a/nixos/hosts/ev/secrets/anki-sync-server-martin.age b/nixos/hosts/ev/secrets/anki-sync-server-martin.age new file mode 100644 index 0000000..1879bbd --- /dev/null +++ b/nixos/hosts/ev/secrets/anki-sync-server-martin.age @@ -0,0 +1,8 @@ +age-encryption.org/v1 +-> ssh-ed25519 PHC5tQ YWmepC45VXIM5wRsq3T7l4Cc8qg0VBMpZVaUu4CwLXY +CViWU8uPX+ud6AqipeNBeQ3NALStQ64PCT+s0cGP/vA +-> ssh-ed25519 PMTW+A 0ch5VrMi3Hj0M4IV4JbVVlMScqs1h7wByALS3zF3Ahk +7/LurMqQ8O89RjdkSANG3CANBLUsHOIc1xLQkZ/mDbg +--- +0gifmDwTlWhS48t9uf3RlidoRmv3zYMXfqWPjUlVPk +*wwO¯Ë0rSÙÑ|-\Ø +Їvu?4¤g^ídVä´ˆŒÇFG?îsŽ7Ý¿Z©
\ No newline at end of file |
