diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/guix.texi | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 5a32476bd3..dd0a46a638 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5899,6 +5899,56 @@ CTAN while fetching the sources from the directory guix import texlive --archive=generic ifxetex @end example +@item json +@cindex JSON, import +Import package metadata from a local JSON file@footnote{This +functionality requires Guile-JSON to be installed. +@xref{Requirements}.}. Consider the following example package +definition in JSON format: + +@example +@{ + "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": ["gcc@@6"] +@} +@end example + +The field names are the same as for the @code{<package>} record +(@xref{Defining Packages}). References to other packages are provided +as JSON lists of quoted package specification strings such as +@code{guile} or @code{guile@@2.0}. + +The importer also supports a more explicit source definition using the +common fields for @code{<origin>} records: + +@example +@{ + @dots{} + "source": @{ + "method": "url-fetch", + "uri": "mirror://gnu/hello/hello-2.10.tar.gz", + "sha256": @{ + "base32": "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i" + @} + @} + @dots{} +@} +@end example + +The command below reads metadata from the JSON file @code{hello.json} +and outputs a package expression: + +@example +guix import json hello.json +@end example + @item nix Import metadata from a local copy of the source of the @uref{http://nixos.org/nixpkgs/, Nixpkgs distribution}@footnote{This |