nixos/postgresql: fix condition for readwritepaths
In the case that the user wants to provide a custom data directory, we need to grant `ReadWritePaths` for that directory. Previously this would not happen when `/var/lib/postgresql` was used, because the condition was not in fact checking for the default data directory, creating a gap in then if-else scenario. Fixes: #371680
This commit is contained in:
@@ -733,10 +733,12 @@ in
|
|||||||
] ++ lib.optionals (any extensionInstalled [ "plv8" ]) [ "@pkey" ];
|
] ++ lib.optionals (any extensionInstalled [ "plv8" ]) [ "@pkey" ];
|
||||||
UMask = if groupAccessAvailable then "0027" else "0077";
|
UMask = if groupAccessAvailable then "0027" else "0077";
|
||||||
}
|
}
|
||||||
(mkIf (cfg.dataDir != "/var/lib/postgresql") {
|
(mkIf (cfg.dataDir != "/var/lib/postgresql/${cfg.package.psqlSchema}") {
|
||||||
|
# The user provides their own data directory
|
||||||
ReadWritePaths = [ cfg.dataDir ];
|
ReadWritePaths = [ cfg.dataDir ];
|
||||||
})
|
})
|
||||||
(mkIf (cfg.dataDir == "/var/lib/postgresql/${cfg.package.psqlSchema}") {
|
(mkIf (cfg.dataDir == "/var/lib/postgresql/${cfg.package.psqlSchema}") {
|
||||||
|
# Provision the default data directory
|
||||||
StateDirectory = "postgresql postgresql/${cfg.package.psqlSchema}";
|
StateDirectory = "postgresql postgresql/${cfg.package.psqlSchema}";
|
||||||
StateDirectoryMode = if groupAccessAvailable then "0750" else "0700";
|
StateDirectoryMode = if groupAccessAvailable then "0750" else "0700";
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user