diff options
Diffstat (limited to 'deployment/services/databases.scm')
| -rw-r--r-- | deployment/services/databases.scm | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/deployment/services/databases.scm b/deployment/services/databases.scm new file mode 100644 index 0000000..7451477 --- /dev/null +++ b/deployment/services/databases.scm @@ -0,0 +1,63 @@ +;;; 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)) + +(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 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 matrix-postgresql-service + (service postgresql-service-type + matrix-postgresql-service-configuration)) |
