From fe0b1ecf0a05895cee6b2ffd93ea9b8741e77c51 Mon Sep 17 00:00:00 2001 From: Gerd Flaig Date: Wed, 25 Dec 2024 14:05:43 +0100 Subject: [PATCH] nixos/paperless: Support remote databases When the database is on another host, unit isolation for the document consumer and scheduler have to be disabled. This is currently enabled by default via `PrivateNetwork = false` in defaultServiceConfig. Following https://github.com/NixOS/nixpkgs/pull/368137#pullrequestreview-2522617890 making this conditional on the `database.createLocally` option. --- nixos/modules/services/misc/paperless.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/modules/services/misc/paperless.nix b/nixos/modules/services/misc/paperless.nix index 9ffb233bd71c..69b8bd959eeb 100644 --- a/nixos/modules/services/misc/paperless.nix +++ b/nixos/modules/services/misc/paperless.nix @@ -331,6 +331,7 @@ in ExecStart = "${cfg.package}/bin/celery --app paperless beat --loglevel INFO"; Restart = "on-failure"; LoadCredential = lib.optionalString (cfg.passwordFile != null) "PAPERLESS_ADMIN_PASSWORD:${cfg.passwordFile}"; + PrivateNetwork = cfg.database.createLocally; # defaultServiceConfig enables this by default, needs to be disabled for remote DBs }; environment = env; @@ -407,6 +408,7 @@ in User = cfg.user; ExecStart = "${cfg.package}/bin/paperless-ngx document_consumer"; Restart = "on-failure"; + PrivateNetwork = cfg.database.createLocally; # defaultServiceConfig enables this by default, needs to be disabled for remote DBs }; environment = env; # Allow the consumer to access the private /tmp directory of the server.