From 8d985892a28033cb1bef592a93aca66a85859710 Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Tue, 2 Jul 2024 18:39:29 +0100 Subject: [PATCH] Create /var/run/pleroma/db automatically This is needed for the containers. --- shared/pleroma/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shared/pleroma/default.nix b/shared/pleroma/default.nix index 7032a412..6fffac4a 100644 --- a/shared/pleroma/default.nix +++ b/shared/pleroma/default.nix @@ -14,6 +14,7 @@ let cfg = config.nixfiles.pleroma; backend = config.nixfiles.oci-containers.backend; backendPkg = if backend == "docker" then pkgs.docker else pkgs.podman; + dbSocketDir = "/var/run/pleroma/db"; in { imports = [ @@ -44,7 +45,7 @@ in username: "pleroma", password: "pleroma", database: "pleroma", - socket_dir: "/var/run/pleroma/db/", + socket_dir: "${dbSocketDir}/", pool_size: 10 config :web_push_encryption, :vapid_details, subject: "mailto:#{System.fetch_env!("NOTIFY_EMAIL")}" @@ -87,10 +88,12 @@ in extraOptions = [ "--shm-size=1g" ]; volumes = [ { name = "pgdata"; inner = "/var/lib/postgresql/data"; } - { host = "/var/run/pleroma/db"; inner = "/var/run/postgresql"; } + { host = dbSocketDir; inner = "/var/run/postgresql"; } ]; }; + systemd.tmpfiles.rules = [ "d ${dbSocketDir} 0700 root root" ]; + nixfiles.restic-backups.backups.pleroma = { prepareCommand = '' /run/wrappers/bin/sudo ${backendPkg}/bin/${backend} exec -i pleroma-db pg_dump -U pleroma --no-owner -Fc pleroma > postgres.dump