From 6b6a5f5e14d8bc7fd9c844648937c607f581b241 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Wed, 21 Oct 2026 19:24:47 +0200 Subject: tweak(ev): stop patching anki-sync-server It takes too long to compile even on good hardware. --- nixos/hosts/ev/default.nix | 16 ++++++++++------ .../patches/anki-sync-server-delete-exclusive-lock.patch | 12 ------------ 2 files changed, 10 insertions(+), 18 deletions(-) delete mode 100644 nixos/hosts/ev/patches/anki-sync-server-delete-exclusive-lock.patch diff --git a/nixos/hosts/ev/default.nix b/nixos/hosts/ev/default.nix index dc77416..bf64198 100644 --- a/nixos/hosts/ev/default.nix +++ b/nixos/hosts/ev/default.nix @@ -148,12 +148,6 @@ 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 = [ @@ -246,6 +240,16 @@ in pruneOpts = ["--keep-daily 30" "--keep-weekly 8" "--keep-monthly 12"]; }; + # Anki opens its SQLite database with an exclusive lock. + systemd.services.restic-backups-sqlite-anki-martin = { + preStart = lib.mkBefore '' + ${pkgs.systemd}/bin/systemctl stop anki-sync-server.service + ''; + postStop = lib.mkAfter '' + ${pkgs.systemd}/bin/systemctl start anki-sync-server.service + ''; + }; + services.restic.backups = { media = { repository = "sftp://${backupHost}:23" + "/media"; 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 deleted file mode 100644 index fdb8990..0000000 --- a/nixos/hosts/ev/patches/anki-sync-server-delete-exclusive-lock.patch +++ /dev/null @@ -1,12 +0,0 @@ -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 { - - 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)?; -- cgit v1.3.1