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

From: Ludovic Courtès <[email-masked]>
Date: Thu, 16 Apr 2020 23:50:04 +0200

Hey!

Ricardo Wurmus <[email-masked]> skribis:

> did you know that we have JSON importer?  Admittedly, it’s not very
> useful because people don’t generally use JSON syntax to define Guix
> packages.  Not even Guix lets you build and install packages from JSON
> definitions, so what’s the point really?
>
> 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.

But… that’s somewhat ambitious and shouldn’t block this improvement!

Ludo’.