From d6a8fccdad5d48d3369c2a73008a61a8007fae25 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Mon, 26 Oct 2020 00:48:10 +0100 Subject: [PATCH] matrix: initialise DB if missing --- matrix.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/matrix.nix b/matrix.nix index d3f7f2c..c0cf2c8 100644 --- a/matrix.nix +++ b/matrix.nix @@ -135,9 +135,18 @@ in }; - # Use the Postrges database + ### Database services.postgresql.enable = true; + # Create database on the first run + services.postgresql.initialScript = pkgs.writeText "synapse-init.sql" '' + CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'synapse'; + CREATE DATABASE "matrix-synapse" WITH OWNER "matrix-synapse" + TEMPLATE template0 + LC_COLLATE = "C" + LC_CTYPE = "C"; + ''; + # Handles users behind a NAT, # needed for reliable VoIP.