aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/databases.scm
diff options
context:
space:
mode:
author宋文武 <iyzsong@member.fsf.org>2023-08-17 18:38:23 +0800
committer宋文武 <iyzsong@member.fsf.org>2023-08-17 18:38:23 +0800
commit0ffbdf34567aedb0ae6cef6b869370a415cfaa65 (patch)
tree76425d441657ffbc6cfe996144cda706eb997a12 /gnu/services/databases.scm
parentd9320de5aa9b77adf5fa31c6429ec8eb08c24458 (diff)
parent1b2d43fe016848ea2ec16ff18cbc14340944fc4e (diff)
downloadguix-0ffbdf34567aedb0ae6cef6b869370a415cfaa65.tar.gz
guix-0ffbdf34567aedb0ae6cef6b869370a415cfaa65.zip
Merge remote-tracking branch 'origin/master' into kde-updates
Diffstat (limited to 'gnu/services/databases.scm')
-rw-r--r--gnu/services/databases.scm37
1 files changed, 25 insertions, 12 deletions
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index 7148971c1d..d3fee2a8ef 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -180,17 +180,30 @@ host all all ::1/128 md5"))
(data-directory postgresql-configuration-data-directory
(default "/var/lib/postgresql/data"))
(extension-packages postgresql-configuration-extension-packages
- (default '())))
-
-(define %postgresql-accounts
- (list (user-group (name "postgres") (system? #t))
- (user-account
- (name "postgres")
- (group "postgres")
- (system? #t)
- (comment "PostgreSQL server user")
- (home-directory "/var/empty")
- (shell (file-append shadow "/sbin/nologin")))))
+ (default '()))
+ (create-account? postgresql-configuration-create-account?
+ (default #t))
+ (uid postgresql-configuration-uid
+ (default #f))
+ (gid postgresql-configuration-gid
+ (default #f)))
+
+(define (create-postgresql-account config)
+ (match-record config <postgresql-configuration>
+ (create-account? uid gid)
+ (if (not create-account?) '()
+ (list (user-group
+ (name "postgres")
+ (id gid)
+ (system? #t))
+ (user-account
+ (name "postgres")
+ (group "postgres")
+ (system? #t)
+ (uid uid)
+ (comment "PostgreSQL server user")
+ (home-directory "/var/empty")
+ (shell (file-append shadow "/sbin/nologin")))))))
(define (final-postgresql postgresql extension-packages)
(if (null? extension-packages)
@@ -327,7 +340,7 @@ host all all ::1/128 md5"))
(service-extension activation-service-type
postgresql-activation)
(service-extension account-service-type
- (const %postgresql-accounts))
+ create-postgresql-account)
(service-extension
profile-service-type
(compose list postgresql-configuration-postgresql))))