Simon Tournier writes: > On Wed, 22 Nov 2023 at 11:19, Ludovic Courtès wrote: > >> As in: >> >> (open-connection >> #:assume-available-builtin-builders '("download")) > > Instead, why not check in ’git-fetch’? Currently, the test is done > against the local daemon, right? > > --8<---------------cut here---------------start------------->8--- > (define* (git-fetch ref hash-algo hash > #:optional name > #:key (system (%current-system)) > guile git) > "Return a fixed-output derivation that fetches REF, a > object. The output is expected to have recursive hash HASH of type > HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." > (mlet %store-monad ((builtins (built-in-builders*))) > (if (member "git-download" builtins) > (git-fetch/built-in ref hash-algo hash name > #:system system) > (git-fetch/in-band ref hash-algo hash name > #:system system > #:guile guile > #:git git)))) > --8<---------------cut here---------------end--------------->8--- > > For example, why not a test as: > > (if (and SOMETHING > (member "git-download" builtins)) > > And this SOMETHING could be a global variable, as > %assume-builtin-builder, set to true by default and turn to false with > an environment variable, as GUIX_ASSUME_BUILTIN. I can think of a couple of reasons not to do this via an environment variable. Having the logic in git-fetch via an environment variable would mean that if other builtins are added, the code generating derivations using them would also have to check the environment variable. Specifying the builtin's that are available on a store connection would work automatically in the case of new builtins being added.. There's also trade-offs in control when using environment variables, or deciding when to take the value from an environment variable and switch to passing the value around through arguments or other means. Consider the case where you have a single process which has multiple store connections open and it wants to specify different available builtin's on particular store connections. This would become quite difficult when using an environment variable, but work easily when specifying the builtins available on the store connection.