From e60725bd3df70da3ce294dc197ad461825ee8c62 Mon Sep 17 00:00:00 2001 From: Kevin Griffin Date: Wed, 29 May 2019 17:21:55 +0900 Subject: [PATCH] postgresql: add character set config `initdb` expects to read the locale or SQL_ASCII environment variable to determine the most appropriate character set. Instead, offer a configuration option. --- modules/services/postgresql/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/services/postgresql/default.nix b/modules/services/postgresql/default.nix index 5b29b68b..35a4aed0 100644 --- a/modules/services/postgresql/default.nix +++ b/modules/services/postgresql/default.nix @@ -61,6 +61,13 @@ in description = ''Data directory for PostgreSQL.''; }; + characterSet = mkOption { + type = types.string; + default = "UTF8"; + example = "SJIS"; + description = ''Character set specified during initialization''; + }; + enableTCPIP = mkOption { type = types.bool; default = false; @@ -101,7 +108,7 @@ in script = '' # Initialise the database. if ! test -e ${cfg.dataDir}/PG_VERSION; then - initdb -U postgres -D ${cfg.dataDir} + initdb -U postgres -D ${cfg.dataDir} -E ${cfg.characterSet} fi ${pkgs.coreutils}/bin/ln -sfn ${configFile} ${cfg.dataDir}/postgresql.conf