Skip to content

Commit 3552704

Browse files
authored
feat(services/postgres): add initdbArgs option (#168)
Add similar setting as nixos/modules/services/databases/postgresql.nix to define custom parameters to `initdb`.
1 parent cff2756 commit 3552704

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

extra/services/postgres.nix

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ in
2020
default = pkgs.postgresql;
2121
defaultText = "pkgs.postgresl";
2222
};
23+
24+
initdbArgs = mkOption {
25+
type = with types; listOf str;
26+
default = [ "--no-locale" ];
27+
example = [ "--data-checksums" "--allow-group-access" ];
28+
description = ''
29+
Additional arguments passed to <literal>initdb</literal> during data dir
30+
initialisation.
31+
'';
32+
};
33+
2334
};
2435
config = {
2536
packages = [ cfg.package ];
@@ -37,7 +48,7 @@ in
3748

3849
devshell.startup.setup-postgres.text = ''
3950
if [[ ! -d "$PGDATA" ]]; then
40-
initdb --no-locale
51+
initdb ${concatStringsSep " " cfg.initdbArgs}
4152
cat >> "$PGDATA/postgresql.conf" <<EOF
4253
listen_addresses = '''
4354
unix_socket_directories = '$PGHOST'

0 commit comments

Comments
 (0)