From 38996b3e0c5a9a0bf1e36e038be286d664a9c272 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Mon, 8 Apr 2024 11:32:34 -0700 Subject: [PATCH] chore(postgresql): shared data --- nixos/postgres.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nixos/postgres.nix b/nixos/postgres.nix index 42c480fc..f1e5ee6d 100644 --- a/nixos/postgres.nix +++ b/nixos/postgres.nix @@ -4,6 +4,7 @@ ... }: let inherit (lib.modules) mkIf mkDefault mkAfter; + inherit (lib) versions; cfg = config.services.postgresql; in { services.postgresql = { @@ -33,10 +34,13 @@ in { ]; }; - systemd.services.postgresql = mkIf cfg.enable { - postStart = mkAfter '' - $PSQL -tAf ${config.sops.secrets.postgresql-init.path} - ''; + systemd = { + services.postgresql = mkIf cfg.enable { + gensokyo-zone.sharedMounts."postgresql/${versions.major cfg.package.version}".path = cfg.dataDir; + postStart = mkAfter '' + $PSQL -tAf ${config.sops.secrets.postgresql-init.path} + ''; + }; }; sops.secrets.postgresql-init = {