summaryrefslogtreecommitdiff
path: root/hosts/surtr/postgresql.nix
blob: a34bc675662dd52de54632937e8c780b5dc13ab1 (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 TEMPLATE "template0" 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";
      '';
    };
  };
}