diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml index a3d9c11e520c..35ffadc17c5b 100644 --- a/nixos/doc/manual/release-notes/rl-2009.xml +++ b/nixos/doc/manual/release-notes/rl-2009.xml @@ -615,6 +615,17 @@ services.dokuwiki."mywiki" = { }; ... }; + + + + + + The option is now set to "/var/lib/postgresql/${cfg.package.psqlSchema}" regardless of your + . Users with an existing postgresql install that have a of 17.09 or below + should double check what the value of their option is (/var/db/postgresql) and then explicitly + set this value to maintain compatibility: + +services.postgresql.dataDir = "/var/db/postgresql"; diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix index 579b6a4d9c67..b883134e7dcb 100644 --- a/nixos/modules/services/databases/postgresql.nix +++ b/nixos/modules/services/databases/postgresql.nix @@ -21,7 +21,7 @@ let listen_addresses = '${if cfg.enableTCPIP then "*" else "localhost"}' port = ${toString cfg.port} ${cfg.extraConfig} - ''; + ''; groupAccessAvailable = versionAtLeast postgresql.version "11.0"; @@ -55,6 +55,7 @@ in dataDir = mkOption { type = types.path; + defaultText = "/var/lib/postgresql/\${config.services.postgresql.package.psqlSchema}"; example = "/var/lib/postgresql/11"; description = '' Data directory for PostgreSQL. @@ -249,10 +250,7 @@ in else if versionAtLeast config.system.stateVersion "16.03" then pkgs.postgresql_9_5 else throw "postgresql_9_4 was removed, please upgrade your postgresql version."); - services.postgresql.dataDir = - mkDefault (if versionAtLeast config.system.stateVersion "17.09" - then "/var/lib/postgresql/${cfg.package.psqlSchema}" - else "/var/db/postgresql"); + services.postgresql.dataDir = mkDefault "/var/lib/postgresql/${cfg.package.psqlSchema}"; services.postgresql.authentication = mkAfter ''