blob: 6d9829124d903347bd8f3265a399fbaeb4fc0313 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; SPDX-FileCopyrightText: 2026 Marek Paśnikowski <marek@marekpasnikowski.pl>
;;; COPYRIGHT NOTICE
;;;
;;; Copyright 2026, Marek Paśnikowski <marek@marekpasnikowski.pl>
;;; LICENSE NOTICE
;;;
;;; This library is free software: you can redistribute it and/or modify it under the terms of
;;; the GNU General Public License as published by the Free Software Foundation,
;;; either version 3 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
;;; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
;;; See the GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License along with this library.
;;; If not, see <https://www.gnu.org/licenses/>.
(define-module (deployment services databases)
#:use-module (gnu services)
#:use-module (gnu services databases)
#:use-module (guix gexp)
#:use-module ((gnu packages databases)
#:prefix gnu:packages:databases:)
#:export (matrix-postgresql-service
postgresql-rakan_service-record
postgresql-role-rakan_service-record))
(define postgres-hba
(mixed-text-file "pg_hba.conf"
"host synapse synapse_user 127.0.0.1/32 trust\n"
"host synapse synapse_user ::1/128 trust\n"
"local all all peer\n"
"host all all 127.0.0.1/32 md5\n"
"host all all ::1/128 md5\n"))
(define config-file
(postgresql-config-file
(log-destination "syslog")
(hba-file postgres-hba)
(ident-file (@@ (gnu services databases)
%default-postgres-ident))
(socket-directory "/var/run/postgresql")
(extra-config (list))))
(define postgresql-rakan_config-file-record
(postgresql-config-file
(log-destination "syslog")
(hba-file (@@ (gnu services databases)
%default-postgres-hba))
(ident-file (@@ (gnu services databases)
%default-postgres-ident))
(socket-directory "/var/run/postgresql")
(extra-config (list))))
(define matrix-postgresql-service-configuration
(postgresql-configuration
(postgresql gnu:packages:databases:postgresql-17)
(port 5432)
(locale "pl_PL.utf8")
(config-file config-file)
(log-directory "/var/log/postgresql")
(data-directory "/var/lib/postgresql/data")
(extension-packages (list))
(create-account? #t)
(home-directory "/var/lib/postgresql")
(allow-login? #t)
(uid 501)
(gid 501)))
(define postgresql-rakan_configuration-record
(postgresql-configuration
(postgresql gnu:packages:databases:postgresql-17)
(port 5432)
(locale "en_US.utf8")
(config-file postgresql-rakan_config-file-record)
(log-directory "/var/log/postgresql")
(data-directory "/var/lib/postgresql/data")
(extension-packages (list))
(create-account? #t)
(allow-login? #f)
(home-directory "/var/lib/postgresql")
(uid 501)
(gid 501)))
(define matrix-postgresql-service
(service postgresql-service-type
matrix-postgresql-service-configuration))
(define postgresql-rakan_service-record
(service postgresql-service-type
postgresql-rakan_configuration-record))
(define postgresql-role-rakan_service-record
(service postgresql-role-service-type
(postgresql-role-configuration
(roles
(list (postgresql-role
(name "cuirass")
(permissions '(createdb login))
(create-database? #t)
(password-file #f)
(encoding "UTF8")
(collation "en_US.utf8")
(ctype "en_US.utf8")
(template "template1"))
(postgresql-role
(name "marek")
(permissions '(createdb login))
(create-database? #f)
(password-file #f)
(encoding "UTF8")
(collation "en_US.utf8")
(ctype "en_US.utf8")
(template "template1")))))))
;;; EOF
|