Subject: Re: bug#45453: Error when I try to build a package using a JSON definition

From: Ricardo Wurmus <[email-masked]>
Date: Sun, 27 Dec 2020 11:40:58 +0100

Hey Julien,

> I'm surprised guix builds from a json file…

it’s a little known feature.  I added it a long time ago, half in jest,
half in the realization that this removes a common superficial objection
to Guix.

> If not, it could be that the source derivation is not
> fixed-output. After all, the json definition doesn't specify a hash
> (it's not even an origin record). Again I'm confused by the fact that
> guix lets you specify packages with json, so I'm not sure how that
> part is converted to a package object. Is that documented?

Yes, it’s all documented.  The manual has to indexed locations for
“JSON”.  One of them says that you don’t need to specify an origin
record, but you can if you feel like it:

--8<---------------cut here---------------start------------->8---
     The importer also supports a more explicit source definition using
     the common fields for ‘<origin>’ records:

          {
            ...
            "source": {
              "method": "url-fetch",
              "uri": "mirror://gnu/hello/hello-2.10.tar.gz",
              "sha256": {
                "base32": "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"
              }
            }
            ...
          }
--8<---------------cut here---------------end--------------->8---

-- 
Ricardo