Subject: Re: [bug#40629] Build and install packages from JSON definitions

From: Ricardo Wurmus <[email-masked]>
Date: Fri, 17 Apr 2020 10:25:11 +0200

Ludovic Courtès <[email-masked]> writes:

>> Well, fret not!  This patch set adds support for JSON package
>> definitions to “guix package -f” and “guix build -f”.  You can now dump
>> this into a file “hello.json”:
>>
>> {
>>   "name": "hello",
>>   "version": "2.10",
>>   "source": "mirror://gnu/hello/hello-2.10.tar.gz",
>>   "build-system": "gnu",
>>   "home-page": "https://www.gnu.org/software/hello/",
>>   "synopsis": "Hello, GNU world: An example GNU package",
>>   "description": "GNU Hello prints a greeting.",
>>   "license": "GPL-3.0+",
>>   "native-inputs": ["gettext"]
>> }
>>
>> and then install the hello package with “guix package -f hello.json”
>> without having to first run the JSON importer.
>
> I think that’s pretty cool!
>
> In a way, it also looks like a special case of the import-on-the-fly use
> case we discussed.  Namely, if you could write:
>
>   guix build json:./foo.json
>   guix install pypi:itsdangerous
>   …
>
> and have the relevant importer automatically invoked, that’d be sweet.

Yes, that was the original goal that motivated writing alist->package
(instead of making this specific to JSON).  I remember vaguely that I
ran into an obstacle back then.  I think this may have predated the
existence of recursive importers, which meant that I couldn’t generate
package objects for packages that had as yet unpackaged inputs.

Perhaps this is no longer a problem and we could take a stab at these
on-the-fly imports.  Infinite packages! :)

--
Ricardo