Hi Arun,

Maybe even package definitions could benefit from a similar idea. There
are a lot of simpler packages (think Emacs packages, many Python
packages, etc.) that don't really benefit from the full expressive power
of scheme. Maybe such a shift could also speed up guix pull
significantly since we won't have to compile scheme source code all the
time. Here's an illustration for a Julia package. This:
```
(define-public julia-json
  (package
    (name "julia-json")
    (version "0.21.3")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/JuliaIO/JSON.jl";)
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
(base32 "1l2p852sxq6h5fif3dqshvbw17gb06jmq2nkr88spvp7s0n0nslz"))))
    (build-system julia-build-system)
    (propagated-inputs
     (list julia-datastructures
           julia-fixedpointnumbers
           julia-parsers
           julia-offsetarrays))
    (home-page "https://github.com/JuliaIO/JSON.jl";)
    (synopsis "JSON parsing and printing library for Julia")
(description "@code{JSON.jl} is a pure Julia module which supports parsing
and printing JSON documents.")
    (license license:expat)))
```
could become:
```
[julia-json]
name = julia-json
version = 0.21.3
source = git+https://github.com/JuliaIO/[email protected]
build_system = julia-build-system
propagated_inputs = [julia-datastructures, julia-fixedpointnumbers,
julia-parsers, julia-offsetarrays]
home_page = https://github.com/JuliaIO/JSON.jl
synopsis = JSON parsing and printing library for Julia
description = @code{JSON.jl} is a pure Julia module which supports parsing
and printing JSON documents.
license = Expat
```

Guix supports JSON package definitions. It's documented in the manual:

--8<---------------cut here---------------start------------->8---
‘json’
    Import package metadata from a local JSON file.  Consider the
    following example package definition in JSON format:

         {
           "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"]
         }

    The field names are the same as for the ‘<package>’ record (*Note
Defining Packages::). References to other packages are provided as JSON lists of quoted package specification strings such as ‘guile’
    or ‘[email protected]’.

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"
             }
           }
           ...
         }

The command below reads metadata from the JSON file ‘hello.json’
    and outputs a package expression:

         guix import json hello.json
--8<---------------cut here---------------end--------------->8---


--
Ricardo

Reply via email to