aboutsummaryrefslogtreecommitdiff
path: root/modules/private/databases/postgresql.nix
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-03-25 11:57:48 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-04-03 16:25:07 +0200
commit5400b9b6f65451d41a9106fae6fc00f97d83f4ef (patch)
tree6ed072da7b1f17ac3994ffea052aa0c0822f8446 /modules/private/databases/postgresql.nix
parent441da8aac378f401625e82caf281fa0e26128310 (diff)
downloadNix-5400b9b6f65451d41a9106fae6fc00f97d83f4ef.tar.gz
Nix-5400b9b6f65451d41a9106fae6fc00f97d83f4ef.tar.zst
Nix-5400b9b6f65451d41a9106fae6fc00f97d83f4ef.zip
Upgrade nixos
Diffstat (limited to 'modules/private/databases/postgresql.nix')
-rw-r--r--modules/private/databases/postgresql.nix17
1 files changed, 3 insertions, 14 deletions
diff --git a/modules/private/databases/postgresql.nix b/modules/private/databases/postgresql.nix
index 27ea59c..d0b1a75 100644
--- a/modules/private/databases/postgresql.nix
+++ b/modules/private/databases/postgresql.nix
@@ -91,23 +91,13 @@ in {
91 ''; 91 '';
92 readOnly = true; 92 readOnly = true;
93 }; 93 };
94 systemdRuntimeDirectory = lib.mkOption {
95 type = lib.types.str;
96 # Use ReadWritePaths= instead if socketsDir is outside of /run
97 default = assert lib.strings.hasPrefix "/run/" cfg.socketsDir;
98 lib.strings.removePrefix "/run/" cfg.socketsDir;
99 description = ''
100 Adjusted Postgresql sockets directory for systemd
101 '';
102 readOnly = true;
103 };
104 }; 94 };
105 }; 95 };
106 96
107 config = lib.mkIf cfg.enable { 97 config = lib.mkIf cfg.enable {
108 networking.firewall.allowedTCPPorts = [ 5432 ]; 98 networking.firewall.allowedTCPPorts = [ 5432 ];
109 99
110 security.acme2.certs."postgresql" = config.myServices.databasesCerts // { 100 security.acme.certs."postgresql" = config.myServices.databasesCerts // {
111 user = "postgres"; 101 user = "postgres";
112 group = "postgres"; 102 group = "postgres";
113 plugins = [ "fullchain.pem" "key.pem" "account_key.json" "account_reg.json" ]; 103 plugins = [ "fullchain.pem" "key.pem" "account_key.json" "account_reg.json" ];
@@ -119,7 +109,6 @@ in {
119 109
120 systemd.services.postgresql.serviceConfig = { 110 systemd.services.postgresql.serviceConfig = {
121 SupplementaryGroups = "keys"; 111 SupplementaryGroups = "keys";
122 RuntimeDirectory = cfg.systemdRuntimeDirectory;
123 }; 112 };
124 systemd.services.postgresql.postStart = lib.mkAfter '' 113 systemd.services.postgresql.postStart = lib.mkAfter ''
125 # This line is already defined in 19.09 114 # This line is already defined in 19.09
@@ -165,8 +154,8 @@ in {
165 # makes it order of magnitudes quicker 154 # makes it order of magnitudes quicker
166 synchronous_commit = off 155 synchronous_commit = off
167 ssl = on 156 ssl = on
168 ssl_cert_file = '${config.security.acme2.certs.postgresql.directory}/fullchain.pem' 157 ssl_cert_file = '${config.security.acme.certs.postgresql.directory}/fullchain.pem'
169 ssl_key_file = '${config.security.acme2.certs.postgresql.directory}/key.pem' 158 ssl_key_file = '${config.security.acme.certs.postgresql.directory}/key.pem'
170 ''; 159 '';
171 authentication = let 160 authentication = let
172 hosts = builtins.concatStringsSep "\n" ( 161 hosts = builtins.concatStringsSep "\n" (