Subject: Improving the ability to build packages only when a substitute is available

From: Richard Sent <[email-masked]>
Date: Tue, 18 Jun 2024 22:53:25 -0400

Hi Guix!

A question came up on IRC asking how to install package foo if and only
if foo has a substitute available on any server (in this case, foo may
be something like a web browser). This is different from the behavior of
--fallback. From [1]:

> Note that when substitutes are disabled or no substitute is available
> for the derivation in question, a local build will _always_ be
> performed, regardless of whether or not ‘--fallback’ was given.

The solution I came up with is "$ guix weather foo && guix install foo".
However, this unfortunately does not work with how guix weather reports
command success. Guix Weather returns nonzero if /any/ substitute server
is missing the substitute, not just one. This hurts the ability to use
guix weather in the context I described since false-negatives in
substitute availability are detected.

In my opinion "returning zero if any substitute server has foo
available" is more useful behavior than "returning zero if and only if
every substitute server has foo".

I propose adding a --strict flag or similar to Guix weather. By default,
Guix weather returns zero if any server has a substitute. With --strict,
the current behavior is used.

Alternatively, a cleaner but potentially more involved solution may be
adding a --only-substitutes or similar flag to all commands that can
initiate builds.

[1]: (info "(guix) Substitution Failure")

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.