summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-01-02 16:54:37 +0000
committerChristopher Baines <mail@cbaines.net>2022-01-02 17:00:09 +0000
commit1dca8a19ef5c6232cd1461e7a61f23ddd72bb973 (patch)
treea44f5aeabdbc9cceb74dd9d6e275c6ed86438e5d /gnu
parentd6a13efe2415c627b97761d8e07cc8483fce3115 (diff)
downloadguix-1dca8a19ef5c6232cd1461e7a61f23ddd72bb973.tar.gz
gnu: Add guix-build-coordinator/agent-only.
This avoids issues where the coordinator component dependencies (like sqitch
and guile-fibers) make it harder to use the agent.

* gnu/packages/package-management.scm (guix-build-coordinator/agent-only): New
variable.
* gnu/services/guix.scm (<guix-build-coordinator-agent-configuration>): Use
the guix-build-coordinator/agent-only package by default.
* doc/guix.texi (Guix Services): Update accordingly.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/package-management.scm94
-rw-r--r--gnu/services/guix.scm2
2 files changed, 95 insertions, 1 deletions
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 8dae9b2d2a..763d91b5df 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -1366,6 +1366,100 @@ potentially many machines, and with doing something with the results and
 outputs of those builds.")
       (license license:gpl3+))))
 
+(define-public guix-build-coordinator/agent-only
+  (package
+    (inherit guix-build-coordinator)
+    (name "guix-build-coordinator-agent-only")
+    (arguments
+     `(#:modules (((guix build guile-build-system)
+                   #:select (target-guile-effective-version))
+                  ,@%gnu-build-system-modules)
+       #:imported-modules ((guix build guile-build-system)
+                           ,@%gnu-build-system-modules)
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'set-GUILE_AUTO_COMPILE
+           (lambda _
+             ;; To avoid warnings relating to 'guild'.
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             #t))
+         (add-after 'install 'wrap-executable
+           (lambda* (#:key inputs outputs target #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (guile (assoc-ref inputs "guile"))
+                    (version (target-guile-effective-version))
+                    (scm (string-append out "/share/guile/site/" version))
+                    (go  (string-append out "/lib/guile/" version "/site-ccache")))
+               (for-each
+                (lambda (file)
+                  (simple-format (current-error-port) "wrapping: ~A\n" file)
+                  (let ((guile-inputs (list
+                                       "guile-json"
+                                       "guile-gcrypt"
+                                       "guix"
+                                       "guile-prometheus"
+                                       "guile-lib"
+                                       "guile-lzlib"
+                                       "guile-zlib"
+                                       "guile-sqlite3"
+                                       "gnutls")))
+                    (wrap-program file
+                      `("PATH" ":" prefix (,bin))
+                      `("GUILE_LOAD_PATH" ":" prefix
+                        (,scm ,(string-join
+                                (map (lambda (input)
+                                       (simple-format
+                                        #f "~A/share/guile/site/~A"
+                                        (assoc-ref inputs input)
+                                        version))
+                                     guile-inputs)
+                                ":")))
+                      `("GUILE_LOAD_COMPILED_PATH" ":" prefix
+                        (,go ,(string-join
+                               (map (lambda (input)
+                                      (simple-format
+                                       #f "~A/lib/guile/~A/site-ccache"
+                                       (assoc-ref inputs input)
+                                       version))
+                                    guile-inputs)
+                               ":"))))))
+                (find-files bin)))
+             #t))
+         (delete 'strip))))             ; As the .go files aren't compatible
+    (native-inputs
+     (list pkg-config
+           autoconf
+           automake
+           gnutls
+
+           ;; Guile libraries are needed here for cross-compilation.
+           guile-json-4
+           guile-gcrypt
+           guix
+           guile-prometheus
+           guile-lib
+           (first (assoc-ref (package-native-inputs guix) "guile"))))
+    (inputs
+     (list (first (assoc-ref (package-native-inputs guix) "guile"))
+           bash-minimal))
+    (propagated-inputs
+     (append
+         (list guile-prometheus
+               guile-gcrypt
+               guile-json-4
+               guile-lib
+               guile-lzlib
+               guile-zlib
+               guix
+               gnutls)))
+    (description
+     "The Guix Build Coordinator helps with performing lots of builds across
+potentially many machines, and with doing something with the results and
+outputs of those builds.
+
+This package just includes the agent component.")))
+
 (define-public guix-jupyter
   (package
     (name "guix-jupyter")
diff --git a/gnu/services/guix.scm b/gnu/services/guix.scm
index a5ed28647f..afaf8e0070 100644
--- a/gnu/services/guix.scm
+++ b/gnu/services/guix.scm
@@ -146,7 +146,7 @@
   make-guix-build-coordinator-agent-configuration
   guix-build-coordinator-agent-configuration?
   (package             guix-build-coordinator-agent-configuration-package
-                       (default guix-build-coordinator))
+                       (default guix-build-coordinator-agent-only))
   (user                guix-build-coordinator-agent-configuration-user
                        (default "guix-build-coordinator-agent"))
   (coordinator         guix-build-coordinator-agent-configuration-coordinator