From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:49575) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOqVo-0007VB-1V for guix-patches@gnu.org; Wed, 15 Apr 2020 18:28:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jOqVm-0004SU-PH for guix-patches@gnu.org; Wed, 15 Apr 2020 18:28:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53929) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jOqVm-0004SI-FX for guix-patches@gnu.org; Wed, 15 Apr 2020 18:28:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jOqVm-0000NA-CF for guix-patches@gnu.org; Wed, 15 Apr 2020 18:28:02 -0400 Subject: [bug#40629] Build and install packages from JSON definitions Resent-Message-ID: References: <87y2qym5v8.fsf@elephly.net> <87v9m061w3.fsf@cbaines.net> From: Ricardo Wurmus In-reply-to: <87v9m061w3.fsf@cbaines.net> Date: Thu, 16 Apr 2020 00:27:39 +0200 Message-ID: <87lfmwmlk4.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Christopher Baines Cc: 40629@debbugs.gnu.org Christopher Baines writes: > Ricardo Wurmus writes: > >> did you know that we have JSON importer? Admittedly, it=E2=80=99s not v= ery >> useful because people don=E2=80=99t generally use JSON syntax to define = Guix >> packages. Not even Guix lets you build and install packages from JSON >> definitions, so what=E2=80=99s the point really? >> >> Well, fret not! This patch set adds support for JSON package >> definitions to =E2=80=9Cguix package -f=E2=80=9D and =E2=80=9Cguix build= -f=E2=80=9D. You can now dump >> this into a file =E2=80=9Chello.json=E2=80=9D: >> >> --8<---------------cut here---------------start------------->8--- >> { >> "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"] >> } >> --8<---------------cut here---------------end--------------->8--- >> >> and then install the hello package with =E2=80=9Cguix package -f hello.j= son=E2=80=9D >> without having to first run the JSON importer. >> >> Since the JSON importer doesn=E2=80=99t know how to work with more than = one >> definition you can=E2=80=99t have more than one custom definition in you= r JSON >> file, but if there=E2=80=99s interest we can easily add support for this. >> >> (My patch set does not come with documentation changes for =E2=80=9Cguix >> package=E2=80=9D or =E2=80=9Cguix build=E2=80=9D.) >> >> What do you think? > > I haven't played with the JSON importer, but this sounds cool. Did you > have any ideas for using this in mind? When I added the JSON importer long ago I also had a commit to extend =E2=80=9Cguix build=E2=80=9D to install packages from JSON descriptions, bu= t that never actually made it into the repository. Even then I didn=E2=80=99t have a grand plan; I just wanted to be able to t= ell the Scheme-averse that they could use JSON instead, e.g. for environment definitions or simple custom packages. It can be a sneaky way to get people to use Guix even though they are initially uncomfortable with Scheme. -- Ricardo