From 6a499bbb8e438870fa810de322f3a36ad8bb4871 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 12 Mar 2025 09:27:47 +0000 Subject: [PATCH] services: guix-data-service: Use a script for database setup. To avoid loading data service code in to the shepherd. * gnu/services/guix.scm (guix-data-service-shepherd-services): Use a script for database setup. Change-Id: Ic67b33a98d63be69c8ee36d6e279d2c5690c179e --- gnu/services/guix.scm | 64 ++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/gnu/services/guix.scm b/gnu/services/guix.scm index 24d22a7a3d..f7da528e66 100644 --- a/gnu/services/guix.scm +++ b/gnu/services/guix.scm @@ -615,33 +615,47 @@ ca-certificates.crt file in the system profile." (requirement '(user-processes postgres)) (one-shot? #t) (start - (with-extensions (cons package - ;; This is a poorly constructed Guile load path, - ;; since it contains things that aren't Guile - ;; libraries, but it means that the Guile - ;; libraries needed for the Guix Data Service - ;; don't need to be individually specified here. - (append - (map second (package-inputs package)) - (map second (package-propagated-inputs package)))) - #~(lambda _ - (use-modules (guix-data-service database) - (guix-data-service model git-repository) - (guix-data-service model build-server)) + #~(make-forkexec-constructor + (list + #$(program-file + "data-service-setup-database" + (with-extensions + (cons package + ;; This is a poorly constructed Guile load path, since + ;; it contains things that aren't Guile libraries, but + ;; it means that the Guile libraries needed for the + ;; Guix Data Service don't need to be individually + ;; specified here. + (append + (map second (package-inputs package)) + (map second (package-propagated-inputs package)))) + #~(lambda _ + (use-modules (guix-data-service database) + (guix-data-service model git-repository) + (guix-data-service model build-server)) - (begin - ((@ (guix-data-service database) run-sqitch)) + (begin + ((@ (guix-data-service database) run-sqitch)) - #$@(if git-repositories - #~(((@ (guix-data-service model git-repository) - specify-git-repositories) - '(#$@git-repositories))) - '()) - #$@(if build-servers - #~(((@ (guix-data-service model build-server) - specify-build-servers) - '(#$@build-servers))) - '()))))) + #$@(if git-repositories + #~(((@ (guix-data-service model git-repository) + specify-git-repositories) + '(#$@git-repositories))) + '()) + #$@(if build-servers + #~(((@ (guix-data-service model build-server) + specify-build-servers) + '(#$@build-servers))) + '())))))) + #:user #$user + #:group #$group + #:directory "/var/lib/guix-data-service" + #:environment-variables + `(,(string-append + "GUIX_LOCPATH=" + #$(libc-utf8-locales-for-target) "/lib/locale") + "LC_ALL=en_US.utf8") + #:log-file "/var/log/guix-data-service/setup-database.log")) (auto-start? #t)) (shepherd-service