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.