summaryrefslogtreecommitdiff
path: root/hosts/surtr/postgresql.nix
blob: f4a122aa53a143465e4c153f38a725d709f6f853 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{ pkgs, ... }:
{
  config = {
    services.postgresql = {
      enable = true;
      package = pkgs.postgresql_14;
      initialScript = pkgs.writeText "schema.sql" ''
        CREATE DATABASE "matrix-synapse" WITH ENCODING "UTF8" LOCALE "C";
        CREATE USER "matrix-synapse";
        GRANT ALL PRIVILEGES ON DATABASE "matrix-synapse" TO "matrix-synapse";
        GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "matrix-synapse";
      '';
    };
  };
}