;;; SPDX-License-Identifier: GPL-3.0-or-later ;;; SPDX-FileCopyrightText: 2026 Marek Paśnikowski ;;; COPYRIGHT NOTICE ;;; ;;; Copyright 2026, Marek Paśnikowski ;;; 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 . (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