~ruther/guix-local

6a499bbb8e438870fa810de322f3a36ad8bb4871 — Christopher Baines 1 year, 4 months ago 49e1504
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
1 files changed, 41 insertions(+), 27 deletions(-)

M gnu/services/guix.scm
M gnu/services/guix.scm => gnu/services/guix.scm +41 -27
@@ 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))

             (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)))
                      '())))))
       #~(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))

                      #$@(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