GNU bug report logs - #67598
[PATCH] gnu: services: guix: Allow gexps evaluating to a list of build-machines

Previous Next

Package: guix-patches;

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.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Saku Laesvuori <saku <at> laesvuori.fi>
Cc: 67598 <at> debbugs.gnu.org
Subject: [bug#67598] [PATCH] gnu: services: guix: Allow gexps evaluating to a list of build-machines
Date: Sun, 10 Dec 2023 22:18:39 +0100
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’.




This bug report was last modified 1 year and 155 days ago.

Previous Next


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