From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:49201) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPMK3-00066H-II for guix-patches@gnu.org; Fri, 17 Apr 2020 04:26:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPMK2-0005Nm-7O for guix-patches@gnu.org; Fri, 17 Apr 2020 04:26:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56594) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPMK2-0005Nc-4H for guix-patches@gnu.org; Fri, 17 Apr 2020 04:26:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jPMK2-0006tW-1Z for guix-patches@gnu.org; Fri, 17 Apr 2020 04:26:02 -0400 Subject: [bug#40629] Build and install packages from JSON definitions Resent-Message-ID: References: <87y2qym5v8.fsf@elephly.net> <87o8rrdrsj.fsf@gnu.org> From: Ricardo Wurmus In-reply-to: <87o8rrdrsj.fsf@gnu.org> Date: Fri, 17 Apr 2020 10:25:11 +0200 Message-ID: <875zdymsd4.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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 40629@debbugs.gnu.org Ludovic Court=C3=A8s writes: >> 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: >> >> { >> "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 =E2=80=9Cguix package -f hello.j= son=E2=80=9D >> without having to first run the JSON importer. > > I think that=E2=80=99s 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 > =E2=80=A6 > > and have the relevant importer automatically invoked, that=E2=80=99d be s= weet. 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=E2=80=99t gener= ate 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