summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_sources/generated.json18
-rw-r--r--_sources/generated.nix12
-rw-r--r--hosts/surtr/postgresql.nix37
-rw-r--r--nvfetcher.toml6
4 files changed, 70 insertions, 3 deletions
diff --git a/_sources/generated.json b/_sources/generated.json
index 0f9eb31f..30b7b120 100644
--- a/_sources/generated.json
+++ b/_sources/generated.json
@@ -131,6 +131,24 @@
131 }, 131 },
132 "version": "c1219b6ac3ee3de887e6a36ae41a8e478835ae92" 132 "version": "c1219b6ac3ee3de887e6a36ae41a8e478835ae92"
133 }, 133 },
134 "psql-versioning": {
135 "cargoLocks": null,
136 "extract": null,
137 "name": "psql-versioning",
138 "passthru": null,
139 "pinned": false,
140 "src": {
141 "deepClone": false,
142 "fetchSubmodules": false,
143 "leaveDotGit": false,
144 "name": null,
145 "rev": "3e578ff5e5aa6c7e5459dbfa842a64a1b2674b2e",
146 "sha256": "sha256-j+njRssJHTdNV3FbcA3MdUmzCaJxuYBrC0qwtK3HoyY=",
147 "type": "git",
148 "url": "https://gitlab.com/depesz/Versioning"
149 },
150 "version": "3e578ff5e5aa6c7e5459dbfa842a64a1b2674b2e"
151 },
134 "uhk-agent": { 152 "uhk-agent": {
135 "cargoLocks": null, 153 "cargoLocks": null,
136 "extract": null, 154 "extract": null,
diff --git a/_sources/generated.nix b/_sources/generated.nix
index 58a1ff0a..30b4aed6 100644
--- a/_sources/generated.nix
+++ b/_sources/generated.nix
@@ -81,6 +81,18 @@
81 sha256 = "sha256-+DoKPIulQA3VSeXo8DjoxnPwDfcuCO5YHpXmB+M7EWk="; 81 sha256 = "sha256-+DoKPIulQA3VSeXo8DjoxnPwDfcuCO5YHpXmB+M7EWk=";
82 }); 82 });
83 }; 83 };
84 psql-versioning = {
85 pname = "psql-versioning";
86 version = "3e578ff5e5aa6c7e5459dbfa842a64a1b2674b2e";
87 src = fetchgit {
88 url = "https://gitlab.com/depesz/Versioning";
89 rev = "3e578ff5e5aa6c7e5459dbfa842a64a1b2674b2e";
90 fetchSubmodules = false;
91 deepClone = false;
92 leaveDotGit = false;
93 sha256 = "sha256-j+njRssJHTdNV3FbcA3MdUmzCaJxuYBrC0qwtK3HoyY=";
94 };
95 };
84 uhk-agent = { 96 uhk-agent = {
85 pname = "uhk-agent"; 97 pname = "uhk-agent";
86 version = "1.5.17"; 98 version = "1.5.17";
diff --git a/hosts/surtr/postgresql.nix b/hosts/surtr/postgresql.nix
index a34bc675..b5035cb2 100644
--- a/hosts/surtr/postgresql.nix
+++ b/hosts/surtr/postgresql.nix
@@ -1,5 +1,7 @@
1{ pkgs, ... }: 1{ pkgs, sources, ... }:
2{ 2let
3 versioning = sources.pqsl-versioning;
4in {
3 config = { 5 config = {
4 services.postgresql = { 6 services.postgresql = {
5 enable = true; 7 enable = true;
@@ -9,6 +11,37 @@
9 CREATE USER "matrix-synapse"; 11 CREATE USER "matrix-synapse";
10 GRANT ALL PRIVILEGES ON DATABASE "matrix-synapse" TO "matrix-synapse"; 12 GRANT ALL PRIVILEGES ON DATABASE "matrix-synapse" TO "matrix-synapse";
11 GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "matrix-synapse"; 13 GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "matrix-synapse";
14
15 CREATE DATABASE "email" WITH TEMPLATE "template0" ENCODING "UTF8" LOCALE "C";
16 CREATE USER "postfix";
17 GRANT CONNECT ON DATABASE "email" TO "postfix";
18 GRANT SELECT ON ALL TABLES IN SCHEMA public TO "postfix";
19 CREATE USER "dovecot2";
20 GRANT CONNECT ON DATABASE "email" TO "dovecot2";
21 GRANT SELECT ON ALL TABLES IN SCHEMA public TO "dovecot2";
22 '';
23 };
24
25 systemd.services.postgresql = {
26 postStart = ''
27 psql email postgres -eXf ${pkgs.writeText "email.sql" ''
28 \i ${versioning + "/install.versioning.sql"}
29
30 BEGIN;
31 select _v.register_patch('000-base', null, null);
32
33 create table virtual_mailbox (
34 id uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
35 local text,
36 CHECK (local IS DISTINCT FROM ''''),
37 domain text NOT NULL,
38 CHECK (domain <> ''''),
39 mailbox text NOT NULL,
40 CHECK (mailbox <> ''''),
41 UNIQUE(COALESCE(local, ''''), domain)
42 );
43 COMMIT;
44 ''}
12 ''; 45 '';
13 }; 46 };
14 }; 47 };
diff --git a/nvfetcher.toml b/nvfetcher.toml
index e82051cd..99db67d0 100644
--- a/nvfetcher.toml
+++ b/nvfetcher.toml
@@ -40,4 +40,8 @@ fetch.github = "gesquive/fast-cli"
40 40
41[xcompose] 41[xcompose]
42src.git = "https://github.com/kragen/xcompose" 42src.git = "https://github.com/kragen/xcompose"
43fetch.github = "kragen/xcompose" \ No newline at end of file 43fetch.github = "kragen/xcompose"
44
45[psql-versioning]
46src.git = "https://gitlab.com/depesz/Versioning"
47fetch.git = "https://gitlab.com/depesz/Versioning" \ No newline at end of file