From 4f42b5faffc70147c77712d95d948225f8123cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Tue, 29 Aug 2023 14:55:25 +0200 Subject: [PATCH] fix: Fix paperless sync --- modules/paperless/default.nix | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/modules/paperless/default.nix b/modules/paperless/default.nix index 61a75a4..55cc08c 100644 --- a/modules/paperless/default.nix +++ b/modules/paperless/default.nix @@ -55,7 +55,7 @@ in { description = "Directory to sync with."; type = types.str; example = "/home/pub_solar/Nextcloud/Paperless"; - default = "/home/${psCfg.user.name}/Paperless"; + default = "/home/${psCfg.user.name}/Nextcloud/Paperless"; }; }; @@ -110,16 +110,23 @@ in { }; systemd = let - copy-in = pkgs.writeShellScriptBin "copy-in" '' - ${pkgs.systemd}/bin/systemctl stop paperless-web.service paperless-task-queue.service paperless-scheduler.service paperless-consumer.service - cp -r ${cfg.sync.directory}/media ${cfg.dataDir}/media - cp ${cfg.sync.directory}/db.sqlite3 ${cfg.dataDir}/db.sqlite3 - ${pkgs.systemd}/bin/systemctl start paperless-web.service paperless-task-queue.service paperless-scheduler.service paperless-consumer.service - ''; copy-out = pkgs.writeShellScriptBin "copy-out" '' ${pkgs.systemd}/bin/systemctl stop paperless-web.service paperless-task-queue.service paperless-scheduler.service paperless-consumer.service cp -r ${cfg.dataDir}/media ${cfg.sync.directory}/media cp ${cfg.dataDir}/db.sqlite3 ${cfg.sync.directory}/db.sqlite3 + cp ${cfg.dataDir}/celerybeat-schedule.db ${cfg.sync.directory}/celerybeat-schedule.db + cp ${cfg.dataDir}/classification_model.pickle ${cfg.sync.directory}/classification_model.pickle + cp ${cfg.dataDir}/src-version ${cfg.sync.directory}/src-version + ${pkgs.systemd}/bin/systemctl start paperless-web.service paperless-task-queue.service paperless-scheduler.service paperless-consumer.service + ''; + + copy-in = pkgs.writeShellScriptBin "copy-in" '' + ${pkgs.systemd}/bin/systemctl stop paperless-web.service paperless-task-queue.service paperless-scheduler.service paperless-consumer.service + cp -r ${cfg.sync.directory}/media ${cfg.dataDir}/media + cp ${cfg.sync.directory}/db.sqlite3 ${cfg.dataDir}/db.sqlite3 + cp ${cfg.sync.directory}/celerybeat-schedule.db ${cfg.dataDir}/celerybeat-schedule.db + cp ${cfg.sync.directory}/classification_model.pickle ${cfg.dataDir}/classification_model.pickle + cp ${cfg.sync.directory}/src-version ${cfg.dataDir}/src-version ${pkgs.systemd}/bin/systemctl start paperless-web.service paperless-task-queue.service paperless-scheduler.service paperless-consumer.service ''; in mkIf cfg.sync.enable {