X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix.git;a=blobdiff_plain;f=modules%2Fprivate%2Fdatabases%2Fpostgresql_replication.nix;h=135bbed0d90bfbc9cd239727ab3ddbfc5a88e649;hp=b103b8c0e965d10b6d26201cf0fd662f2799adf7;hb=4c4652aabf2cb3ac8b40f2856eca07a1df9c27e0;hpb=da30ae4ffdd153a1eb32fb86f9ca9a65aa19e4e2 diff --git a/modules/private/databases/postgresql_replication.nix b/modules/private/databases/postgresql_replication.nix index b103b8c..135bbed 100644 --- a/modules/private/databases/postgresql_replication.nix +++ b/modules/private/databases/postgresql_replication.nix @@ -62,9 +62,8 @@ in users.groups.postgres.gid = config.ids.gids.postgres; environment.systemPackages = [ cfg.mainPackage ]; - secrets.keys = lib.flatten (lib.mapAttrsToList (name: hcfg: [ - { - dest = "postgresql_replication/${name}/recovery.conf"; + secrets.keys = lib.listToAttrs (lib.flatten (lib.mapAttrsToList (name: hcfg: [ + (lib.nameValuePair "postgresql_replication/${name}/recovery.conf" { user = "postgres"; group = "postgres"; permissions = "0400"; @@ -73,16 +72,14 @@ in primary_conninfo = '${hcfg.connection}?sslmode=require' primary_slot_name = '${hcfg.slot}' ''; - } - { - dest = "postgresql_replication/${name}/connection_string"; + }) + (lib.nameValuePair "postgresql_replication/${name}/connection_string" { user = "postgres"; group = "postgres"; permissions = "0400"; text = hcfg.connection; - } - { - dest = "postgresql_replication/${name}/postgresql.conf"; + }) + (lib.nameValuePair "postgresql_replication/${name}/postgresql.conf" { user = "postgres"; group = "postgres"; permissions = "0400"; @@ -94,8 +91,8 @@ in data_directory = '${dataDir}' wal_level = logical ''; - } - ]) cfg.hosts); + }) + ]) cfg.hosts)); services.cron = { enable = true;