GNU bug report logs - #70263
[PATCH] gnu: guix-configuration: Improve offload build-machines.

Previous Next

Package: guix-patches;

Reported by: Ian Eure <ian <at> retrospec.tv>

Date: Sun, 7 Apr 2024 19:22:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

To reply to this bug, email your comments to 70263 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#70263; Package guix-patches. (Sun, 07 Apr 2024 19:22:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ian Eure <ian <at> retrospec.tv>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 07 Apr 2024 19:22:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ian Eure <ian <at> retrospec.tv>
To: guix-patches <at> gnu.org
Cc: Ian Eure <ian <at> retrospec.tv>
Subject: [PATCH] gnu: guix-configuration: Improve offload build-machines.
Date: Sun,  7 Apr 2024 12:20:59 -0700
It’s currently difficult to programmatically add a build-machine, because the
`service-extension' mechanism is the only facility which can do that.  It
relies on the `guix-service-type', ala:

    (service-extension guix-service-type
      (guix-extension (build-machines (list ...))))

...but `guix-service-type' is already instantiated as part of
`%base-services', and replacing it may lose other configuration, like
substitute servers and authorized keys.

Additionally, a default value of `#f' for the build-machines field requires
guarding uses of the field with:

    (or (guix-build-machines config) '())

Changing the default to be the empty list avoids that.  One can now add
build-machines with code such as:

    (modify-services %base-services
      (guix-service-type
       config =>
       (guix-configuration
        (inherit config)
        (authorized-keys
         (cons %build-machine-key
               (guix-configuration-authorized-keys config)))
        (build-machines (cons #~(build-machine ...)
                              (guix-configuration-build-machines config))))))

* gnu/services/base.scm (guix-configuration): Rename `guix-build-machines' to
`guix-configuration-build-machines' and export it.  Change the default from
`#f' to the empty list.
* gnu/services/base.scm (guix-activation): Update the build-machines test and
reverse the conditions.

Change-Id: I6780c6a5579fd9d4b4f22ee2b2bf7ba7a0454407
---
 gnu/services/base.scm | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 3f912225a0..5cf6083821 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -212,6 +212,7 @@ (define-module (gnu services base)
             guix-configuration-guix
             guix-configuration-build-group
             guix-configuration-build-accounts
+            guix-configuration-build-machines
             guix-configuration-authorize-key?
             guix-configuration-authorized-keys
             guix-configuration-use-substitutes?
@@ -1848,8 +1849,8 @@ (define-record-type* <guix-configuration>
                     (default #f))
   (tmpdir           guix-tmpdir                   ;string | #f
                     (default #f))
-  (build-machines   guix-build-machines           ;list of gexps | #f
-                    (default #f))
+  (build-machines   guix-configuration-build-machines ;list of gexps | '()
+                    (default '()))
   (environment      guix-configuration-environment  ;list of strings
                     (default '())))
 
@@ -2044,10 +2045,10 @@ (define (guix-activation config)
         #$(and channels (install-channels-file channels))
 
         ;; ... and /etc/guix/machines.scm.
-        #$(if (guix-build-machines config)
+        #$(if (null? (guix-configuration-build-machines config))
+              #~#f
               (guix-machines-files-installation
-               #~(list #$@(guix-build-machines config)))
-              #~#f))))
+               #~(list #$@(guix-configuration-build-machines config)))))))
 
 (define-record-type* <guix-extension>
   guix-extension make-guix-extension
@@ -2093,9 +2094,9 @@ (define guix-service-type
               (substitute-urls (append (guix-extension-substitute-urls extension)
                                        (guix-configuration-substitute-urls config)))
               (build-machines
-               (and (or (guix-build-machines config)
+               (and (or (guix-configuration-build-machines config)
                         (pair? (guix-extension-build-machines extension)))
-                    (append (or (guix-build-machines config) '())
+                    (append (guix-configuration-build-machines config)
                             (guix-extension-build-machines extension))))
               (chroot-directories
                (append (guix-extension-chroot-directories extension)

base-commit: ab3731d255ff1ac8d6874bc0f68ad94f21f08e79
-- 
2.41.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sat, 04 May 2024 17:14:02 GMT) Full text and rfc822 format available.

Notification sent to Ian Eure <ian <at> retrospec.tv>:
bug acknowledged by developer. (Sat, 04 May 2024 17:14:02 GMT) Full text and rfc822 format available.

Message #10 received at 70263-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Ian Eure <ian <at> retrospec.tv>
Cc: 70263-done <at> debbugs.gnu.org
Subject: Re: [bug#70263] [PATCH] gnu: guix-configuration: Improve offload
 build-machines.
Date: Sat, 04 May 2024 19:12:59 +0200
Hi Ian,

Ian Eure <ian <at> retrospec.tv> skribis:

> It’s currently difficult to programmatically add a build-machine, because the
> `service-extension' mechanism is the only facility which can do that.  It
> relies on the `guix-service-type', ala:
>
>     (service-extension guix-service-type
>       (guix-extension (build-machines (list ...))))
>
> ...but `guix-service-type' is already instantiated as part of
> `%base-services', and replacing it may lose other configuration, like
> substitute servers and authorized keys.
>
> Additionally, a default value of `#f' for the build-machines field requires
> guarding uses of the field with:
>
>     (or (guix-build-machines config) '())
>
> Changing the default to be the empty list avoids that.  One can now add
> build-machines with code such as:
>
>     (modify-services %base-services
>       (guix-service-type
>        config =>
>        (guix-configuration
>         (inherit config)
>         (authorized-keys
>          (cons %build-machine-key
>                (guix-configuration-authorized-keys config)))
>         (build-machines (cons #~(build-machine ...)
>                               (guix-configuration-build-machines config))))))
>
> * gnu/services/base.scm (guix-configuration): Rename `guix-build-machines' to
> `guix-configuration-build-machines' and export it.  Change the default from
> `#f' to the empty list.
> * gnu/services/base.scm (guix-activation): Update the build-machines test and
> reverse the conditions.

That makes a lot of sense to me.  Applied, thanks!

Ludo’.




This bug report was last modified 2 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.