summary refs log tree commit diff
path: root/doc/guix.texi
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2017-08-27 17:41:18 +0200
committerRicardo Wurmus <rekado@elephly.net>2017-09-28 13:10:11 +0200
commitfb1db385476bc4548d3eadea93b5dd6a346839f2 (patch)
tree6c505efc758fc6ecc15c567a906d353d5ef1adb5 /doc/guix.texi
parent5e892bc365a3da0d30a0982783ee2ab82ee090f8 (diff)
downloadguix-fb1db385476bc4548d3eadea93b5dd6a346839f2.tar.gz
import: Add JSON importer.
* doc/guix.texi (Invoking guix import): Document it.
* guix/scripts/import/json.scm: New file.
* Makefile.am (MODULES): Add it.
* guix/scripts/import.scm (importers): Add json importer.
Diffstat (limited to 'doc/guix.texi')
-rw-r--r--doc/guix.texi50
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