Subject: [bug#75647] [PATCH v2 1/2] profiles: Add #:build? argument to lower-manifest-entry.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 27 Jan 2025 17:34:33 +0100

Hi,

[email-masked] skribis:

> From: 宋文武 <[email-masked]>
>
> * guix/profiles.scm (lower-manifest-entry): Add #:build? keyword argument.
>
> Change-Id: Ifb86d581156034897377f3614fac67b7748e0ec3

[...]

> @@ -319,12 +320,20 @@ (define* (lower-manifest-entry entry system #:key target)
>  
>    (let ((item (manifest-entry-item entry)))
>      (if (string? item)
> -        (with-monad %store-monad
> +        (mbegin %store-monad
> +          (build (list item))
> +          (if build?
> +              (build (list item))
> +              (return #t))
>            (return entry))
> -        (mlet %store-monad ((drv (lower-object item system
> +        (mlet* %store-monad ((drv (lower-object item system
>                                                 #:target target))
> +
>                              (dependencies (recurse entry))
> -                            (output -> (manifest-entry-output entry)))
> +                            (output -> (manifest-entry-output entry))
> +                            (built (if build?
> +                                       (built-derivations (list (cons drv output)))

Overall, I think that building things individually is a bad idea because
it prevents parallelism and makes things overall slower (even if the
“build handler” mechanism mitigates that¹).

You wrote:

> Hello, these patches make each profile hook run upon its specified interested
> inputs, eg: the 'info-dir-file' hook only get inputs with info manuals,
> install a package without info files won't trigger it.  Thus reduce the chance
> and time to rerun them when your profile changed.

The ‘info-dir-file’ hooks runs instantly when there are no Info files,
so that’s probably not a good example.

> Years ago tried in <https://issues.guix.gnu.org/29928>, now it seems I don't
> need some hack like 'eval-gexp', just need all manifest entries built before
> hooks.

Yeah, I’m not sure how to move forward.

Perhaps you could identify specific cases of profile hooks that may
often run and use resources for no good reason?

Thanks,
Ludo’.

¹ https://guix.gnu.org/en/blog/2020/grafts-continued/