Simon Tournier <zimon.toutoune@gmail.com> writes:
Toggle quote (37 lines)
> On Wed, 22 Nov 2023 at 11:19, Ludovic Courtès <ludo@gnu.org> 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 <git-reference>
> 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.
-----BEGIN PGP SIGNATURE-----
iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmZIrdVfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XdqjA//b4o7EtVAvNwn74bDVPz+ol0tR+YxAvnd
yDVROXMS8Bd+KXobt+bjb3Bfp2bKi0XIUq9SaHYTJDJryVqEjBbgVyKSf1tGcWTh
yLCakfYs2Aqb+G30Q0y4/kGDCTlNEB0vQs7NXRgsyZNrpiowNsux7k1aXpgd0Mbg
Hz/oiY8tIDtpUXHQIZ98oxli9lv1FXd1GMLQUEb8dSBE/VP1tCjGxX0+JIgKMaCo
J2zZBy7pInE0z//7yjq95YTu00tfBlaMgg+COQYAJ+ilcLBsLcdIHGQiRm85Rtx3
AQn32qGcR/vFcl6I0bJotVSo5X5hbu4+pDKPDlztvMa5t4MfdlY9/NF8vZ0VdKdG
SBRZoc+7JZfGB5oDbUyL+RoL73D8R/byX4Qc3v/oq5IRCpLJiUu915ZS09mhDR1x
kCOJ5vV2JHv0NFAx8goQYplocN+CrqJ0stp5lFEbqRNKEPjKpFP3UnaxUCE6ncUc
uUYG8B9IF3BQHNgSTdi9PjKaD3sCyRURiiM1b0tvzM8DQJycjHWPkGve34lk1Z/9
CYq7q2oyrLQKKJ0cMGFN18ZQbEu2Mb+E7vyBxxYK2ZgIGBRBNsJCj4QnBJDhTrY6
f3bdHqvL/Ew5+PI91T9E5NRDn/8g/9eYiKGJIY42St+HhOc19JeC5qYFy6MoLie9
ZUy+SFnqAM8=
=owCS
-----END PGP SIGNATURE-----