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";
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";
data_directory = '${dataDir}'
wal_level = logical
'';
- }
- ]) cfg.hosts);
+ })
+ ]) cfg.hosts));
services.cron = {
enable = true;