GNU bug report logs -
#67598
[PATCH] gnu: services: guix: Allow gexps evaluating to a list of build-machines
Previous Next
Reported by: Saku Laesvuori <saku <at> laesvuori.fi>
Date: Sun, 3 Dec 2023 09:34:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67598 in the body.
You can then email your comments to 67598 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#67598
; Package
guix-patches
.
(Sun, 03 Dec 2023 09:34:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Saku Laesvuori <saku <at> laesvuori.fi>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Sun, 03 Dec 2023 09:34:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* gnu/services/base.scm (guix-machines-files-installation): Handle
machines being a mixed list of build-machines and lists of
build-machines.
* doc/guix.texi: Document it.
Change-Id: Ie404562ca0b564413233c3a624046da831893dc3
---
This enables doing things like the DNS-SD example mentioned in '2.4.2
Using the Offload Facility' directly from the operating-system
declaration.
doc/guix.texi | 9 ++++++---
gnu/services/base.scm | 8 +++++++-
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 1fd2e21608..3e599742c3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19316,7 +19316,8 @@ Base Services
@anchor{guix-configuration-build-machines}
@item @code{build-machines} (default: @code{#f})
This field must be either @code{#f} or a list of gexps evaluating to a
-@code{build-machine} record (@pxref{Daemon Offload Setup}).
+@code{build-machine} record or to a list of @code{build-machine} records
+(@pxref{Daemon Offload Setup}).
When it is @code{#f}, the @file{/etc/guix/machines.scm} file is left
untouched. Otherwise, the list of of gexps is written to
@@ -19329,7 +19330,8 @@ Base Services
(guix-configuration
(build-machines
(list #~(build-machine (name "foo.example.org") @dots{})
- #~(build-machine (name "bar.example.org") @dots{}))))
+ #~(list (build-machine (name "bar.example.org") @dots{})
+ (build-machine (name "foobaz.example.org") @dots{})))))
@end lisp
Additional build machines may be added @i{via} the @code{guix-extension}
@@ -19385,7 +19387,8 @@ Base Services
A list of strings where each element is a substitute URL.
@item @code{build-machines} (default: @code{'()})
-A list of gexps that evaluate to @code{build-machine} records
+A list of gexps that evaluate to @code{build-machine} records or to a list of
+@code{build-machine} records.
(@pxref{Daemon Offload Setup}).
Using this field, a service may add new build machines to receive builds
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 82c6940780..beb710f95c 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1765,7 +1765,13 @@ (define (guix-machines-files-installation machines)
(mkdir-p (dirname machines-file)))
;; Installed the declared machines file.
- (symlink #+(scheme-file "machines.scm" machines)
+ (symlink #+(scheme-file "machines.scm"
+ `(apply append
+ (map (lambda (entry)
+ (if (list? entry)
+ entry
+ (list entry)))
+ ,machines)))
machines-file))))
(define-record-type* <guix-configuration>
base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
--
2.41.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#67598
; Package
guix-patches
.
(Sun, 10 Dec 2023 21:20:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 67598 <at> debbugs.gnu.org (full text, mbox):
Hi,
Saku Laesvuori <saku <at> laesvuori.fi> skribis:
> * gnu/services/base.scm (guix-machines-files-installation): Handle
> machines being a mixed list of build-machines and lists of
> build-machines.
> * doc/guix.texi: Document it.
>
> Change-Id: Ie404562ca0b564413233c3a624046da831893dc3
Sounds useful!
> (guix-configuration
> (build-machines
> (list #~(build-machine (name "foo.example.org") @dots{})
> - #~(build-machine (name "bar.example.org") @dots{}))))
> + #~(list (build-machine (name "bar.example.org") @dots{})
> + (build-machine (name "foobaz.example.org") @dots{})))))
I wouldn’t show both in the same example as it can be confusing. So
either leave the example unchanged or add a second one (maybe with
‘guix-extension’?).
> + (symlink #+(scheme-file "machines.scm"
> + `(apply append
Use ‘concatenate’ instead, and #~ instead of `.
> + (map (lambda (entry)
> + (if (list? entry)
> + entry
> + (list entry)))
> + ,machines)))
Since ‘list?’ is linear in the number of elements in the list, my
preference would be to write it like this:
(if (build-machine? entry)
(list entry)
entry)
Could you send an updated patch?
Thanks,
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#67598
; Package
guix-patches
.
(Mon, 11 Dec 2023 07:29:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 67598 <at> debbugs.gnu.org (full text, mbox):
* gnu/services/base.scm (guix-machines-files-installation): Handle
machines being a mixed list of build-machines and lists of
build-machines.
* doc/guix.texi: Document it.
Change-Id: Ie404562ca0b564413233c3a624046da831893dc3
---
doc/guix.texi | 6 ++++--
gnu/services/base.scm | 8 +++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 1fd2e21608..e74aa631b7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19316,7 +19316,8 @@ Base Services
@anchor{guix-configuration-build-machines}
@item @code{build-machines} (default: @code{#f})
This field must be either @code{#f} or a list of gexps evaluating to a
-@code{build-machine} record (@pxref{Daemon Offload Setup}).
+@code{build-machine} record or to a list of @code{build-machine} records
+(@pxref{Daemon Offload Setup}).
When it is @code{#f}, the @file{/etc/guix/machines.scm} file is left
untouched. Otherwise, the list of of gexps is written to
@@ -19385,7 +19386,8 @@ Base Services
A list of strings where each element is a substitute URL.
@item @code{build-machines} (default: @code{'()})
-A list of gexps that evaluate to @code{build-machine} records
+A list of gexps that evaluate to @code{build-machine} records or to a list of
+@code{build-machine} records.
(@pxref{Daemon Offload Setup}).
Using this field, a service may add new build machines to receive builds
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 82c6940780..f060feab12 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1765,7 +1765,13 @@ (define (guix-machines-files-installation machines)
(mkdir-p (dirname machines-file)))
;; Installed the declared machines file.
- (symlink #+(scheme-file "machines.scm" machines)
+ (symlink #+(scheme-file "machines.scm"
+ #~((@ (srfi srfi-1) concatenate)
+ (map (lambda (entry)
+ (if (build-machine? entry)
+ (list entry)
+ entry))
+ #$machines)))
machines-file))))
(define-record-type* <guix-configuration>
base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
--
2.41.0
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Thu, 14 Dec 2023 21:09:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Saku Laesvuori <saku <at> laesvuori.fi>
:
bug acknowledged by developer.
(Thu, 14 Dec 2023 21:09:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 67598-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
Saku Laesvuori <saku <at> laesvuori.fi> skribis:
> * gnu/services/base.scm (guix-machines-files-installation): Handle
> machines being a mixed list of build-machines and lists of
> build-machines.
> * doc/guix.texi: Document it.
>
> Change-Id: Ie404562ca0b564413233c3a624046da831893dc3
Applied with the small change below (hadn’t realized earlier that we
could use ‘append-map’). Thanks!
Ludo’.
[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 3a4d8e789c..6539bfd6ce 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1768,12 +1768,12 @@ (define (guix-machines-files-installation machines)
;; Installed the declared machines file.
(symlink #+(scheme-file "machines.scm"
- #~((@ (srfi srfi-1) concatenate)
- (map (lambda (entry)
- (if (build-machine? entry)
- (list entry)
- entry))
- #$machines)))
+ #~((@ (srfi srfi-1) append-map)
+ (lambda (entry)
+ (if (build-machine? entry)
+ (list entry)
+ entry))
+ #$machines))
machines-file))))
(define-record-type* <guix-configuration>
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 12 Jan 2024 12:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 118 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.