diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2020-12-05 06:16:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-05 06:16:24 +0000 |
commit | 55b348fe1b0417fa20902bfb1133aebf833cae44 (patch) | |
tree | 1c6707ff57715fb765dae98a760b8a51371a17ab /doc | |
parent | 4763e8b8fd805f63a707257b3c0bd6a1af90d7d8 (diff) | |
parent | 7ba8820008a9fc767377bbc5f67bf85aee514bee (diff) |
Merge master into staging-next
Diffstat (limited to 'doc')
-rw-r--r-- | doc/builders/packages/index.xml | 2 | ||||
-rw-r--r-- | doc/builders/packages/shell-helpers.section.md | 12 | ||||
-rw-r--r-- | doc/builders/packages/shell-helpers.xml | 21 | ||||
-rw-r--r-- | doc/languages-frameworks/index.xml | 2 | ||||
-rw-r--r-- | doc/languages-frameworks/ocaml.section.md | 70 | ||||
-rw-r--r-- | doc/languages-frameworks/ocaml.xml | 73 |
6 files changed, 84 insertions, 96 deletions
diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index 38d72a4748f6..c7a4aa9f47dc 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -17,7 +17,7 @@ <xi:include href="locales.xml" /> <xi:include href="nginx.section.xml" /> <xi:include href="opengl.section.xml" /> - <xi:include href="shell-helpers.xml" /> + <xi:include href="shell-helpers.section.xml" /> <xi:include href="steam.xml" /> <xi:include href="cataclysm-dda.section.xml" /> <xi:include href="urxvt.section.xml" /> diff --git a/doc/builders/packages/shell-helpers.section.md b/doc/builders/packages/shell-helpers.section.md new file mode 100644 index 000000000000..57b8619c5007 --- /dev/null +++ b/doc/builders/packages/shell-helpers.section.md @@ -0,0 +1,12 @@ +# Interactive shell helpers {#sec-shell-helpers} + +Some packages provide the shell integration to be more useful. But unlike other systems, nix doesn't have a standard `share` directory location. This is why a bunch `PACKAGE-share` scripts are shipped that print the location of the corresponding shared folder. Current list of such packages is as following: + +- `fzf` : `fzf-share` + +E.g. `fzf` can then used in the `.bashrc` like this: + +```bash +source "$(fzf-share)/completion.bash" +source "$(fzf-share)/key-bindings.bash" +``` diff --git a/doc/builders/packages/shell-helpers.xml b/doc/builders/packages/shell-helpers.xml deleted file mode 100644 index a4ac9022c4ce..000000000000 --- a/doc/builders/packages/shell-helpers.xml +++ /dev/null @@ -1,21 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xml:id="sec-shell-helpers"> - <title>Interactive shell helpers</title> - - <para> - Some packages provide the shell integration to be more useful. But unlike other systems, nix doesn't have a standard share directory location. This is why a bunch <command>PACKAGE-share</command> scripts are shipped that print the location of the corresponding shared folder. Current list of such packages is as following: - <itemizedlist> - <listitem> - <para> - <literal>fzf</literal>: <command>fzf-share</command> - </para> - </listitem> - </itemizedlist> - E.g. <literal>fzf</literal> can then used in the .bashrc like this: -<screen> - source "$(fzf-share)/completion.bash" - source "$(fzf-share)/key-bindings.bash" -</screen> - </para> -</section> diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml index 5046ce00b9a9..daa57cf1f865 100644 --- a/doc/languages-frameworks/index.xml +++ b/doc/languages-frameworks/index.xml @@ -21,7 +21,7 @@ <xi:include href="lua.section.xml" /> <xi:include href="maven.section.xml" /> <xi:include href="node.section.xml" /> - <xi:include href="ocaml.xml" /> + <xi:include href="ocaml.section.xml" /> <xi:include href="perl.xml" /> <xi:include href="php.section.xml" /> <xi:include href="python.section.xml" /> diff --git a/doc/languages-frameworks/ocaml.section.md b/doc/languages-frameworks/ocaml.section.md new file mode 100644 index 000000000000..1c5a5473a05e --- /dev/null +++ b/doc/languages-frameworks/ocaml.section.md @@ -0,0 +1,70 @@ +# OCaml {#sec-language-ocaml} + +OCaml libraries should be installed in `$(out)/lib/ocaml/${ocaml.version}/site-lib/`. Such directories are automatically added to the `$OCAMLPATH` environment variable when building another package that depends on them or when opening a `nix-shell`. + +Given that most of the OCaml ecosystem is now built with dune, nixpkgs includes a convenience build support function called `buildDunePackage` that will build an OCaml package using dune, OCaml and findlib and any additional dependencies provided as `buildInputs` or `propagatedBuildInputs`. + +Here is a simple package example. It defines an (optional) attribute `minimumOCamlVersion` that will be used to throw a descriptive evaluation error if building with an older OCaml is attempted. It uses the `fetchFromGitHub` fetcher to get its source. It sets the `doCheck` (optional) attribute to `true` which means that tests will be run with `dune runtest -p angstrom` after the build (`dune build -p angstrom`) is complete. It uses `alcotest` as a build input (because it is needed to run the tests) and `bigstringaf` and `result` as propagated build inputs (thus they will also be available to libraries depending on this library). The library will be installed using the `angstrom.install` file that dune generates. + +```nix +{ stdenv +, fetchFromGitHub +, buildDunePackage +, alcotest +, result +, bigstringaf +}: + +buildDunePackage rec { + pname = "angstrom"; + version = "0.10.0"; + + minimumOCamlVersion = "4.03"; + + src = fetchFromGitHub { + owner = "inhabitedtype"; + repo = pname; + rev = version; + sha256 = "0lh6024yf9ds0nh9i93r9m6p5psi8nvrqxl5x7jwl13zb0r9xfpw"; + }; + + buildInputs = [ alcotest ]; + propagatedBuildInputs = [ bigstringaf result ]; + doCheck = true; + + meta = { + homepage = "https://github.com/inhabitedtype/angstrom"; + description = "OCaml parser combinators built for speed and memory efficiency"; + license = stdenv.lib.licenses.bsd3; + maintainers = with stdenv.lib.maintainers; [ sternenseemann ]; + }; +} +``` + +Here is a second example, this time using a source archive generated with `dune-release`. It is a good idea to use this archive when it is available as it will usually contain substituted variables such as a `%%VERSION%%` field. This library does not depend on any other OCaml library and no tests are run after building it. + +```nix +{ stdenv +, fetchurl +, buildDunePackage +}: + +buildDunePackage rec { + pname = "wtf8"; + version = "1.0.1"; + + minimumOCamlVersion = "4.01"; + + src = fetchurl { + url = "https://github.com/flowtype/ocaml-${pname}/releases/download/v${version}/${pname}-${version}.tbz"; + sha256 = "1msg3vycd3k8qqj61sc23qks541cxpb97vrnrvrhjnqxsqnh6ygq"; + }; + + meta = with stdenv.lib; { + homepage = "https://github.com/flowtype/ocaml-wtf8"; + description = "WTF-8 is a superset of UTF-8 that allows unpaired surrogates."; + license = licenses.mit; + maintainers = [ maintainers.eqyiel ]; + }; +} +``` diff --git a/doc/languages-frameworks/ocaml.xml b/doc/languages-frameworks/ocaml.xml deleted file mode 100644 index 3f72092ec150..000000000000 --- a/doc/languages-frameworks/ocaml.xml +++ /dev/null @@ -1,73 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xml:id="sec-language-ocaml"> - <title>OCaml</title> - - <para> - OCaml libraries should be installed in <literal>$(out)/lib/ocaml/${ocaml.version}/site-lib/</literal>. Such directories are automatically added to the <literal>$OCAMLPATH</literal> environment variable when building another package that depends on them or when opening a <literal>nix-shell</literal>. - </para> - - <para> - Given that most of the OCaml ecosystem is now built with dune, nixpkgs includes a convenience build support function called <literal>buildDunePackage</literal> that will build an OCaml package using dune, OCaml and findlib and any additional dependencies provided as <literal>buildInputs</literal> or <literal>propagatedBuildInputs</literal>. - </para> - - <para> - Here is a simple package example. It defines an (optional) attribute <literal>minimumOCamlVersion</literal> that will be used to throw a descriptive evaluation error if building with an older OCaml is attempted. It uses the <literal>fetchFromGitHub</literal> fetcher to get its source. It sets the <literal>doCheck</literal> (optional) attribute to <literal>true</literal> which means that tests will be run with <literal>dune runtest -p angstrom</literal> after the build (<literal>dune build -p angstrom</literal>) is complete. It uses <literal>alcotest</literal> as a build input (because it is needed to run the tests) and <literal>bigstringaf</literal> and <literal>result</literal> as propagated build inputs (thus they will also be available to libraries depending on this library). The library will be installed using the <literal>angstrom.install</literal> file that dune generates. - </para> - -<programlisting> -{ stdenv, fetchFromGitHub, buildDunePackage, alcotest, result, bigstringaf }: - -buildDunePackage rec { - pname = "angstrom"; - version = "0.10.0"; - - minimumOCamlVersion = "4.03"; - - src = fetchFromGitHub { - owner = "inhabitedtype"; - repo = pname; - rev = version; - sha256 = "0lh6024yf9ds0nh9i93r9m6p5psi8nvrqxl5x7jwl13zb0r9xfpw"; - }; - - buildInputs = [ alcotest ]; - propagatedBuildInputs = [ bigstringaf result ]; - doCheck = true; - - meta = { - homepage = "https://github.com/inhabitedtype/angstrom"; - description = "OCaml parser combinators built for speed and memory efficiency"; - license = stdenv.lib.licenses.bsd3; - maintainers = with stdenv.lib.maintainers; [ sternenseemann ]; - }; -} -</programlisting> - - <para> - Here is a second example, this time using a source archive generated with <literal>dune-release</literal>. It is a good idea to use this archive when it is available as it will usually contain substituted variables such as a <literal>%%VERSION%%</literal> field. This library does not depend on any other OCaml library and no tests are run after building it. - </para> - -<programlisting> -{ stdenv, fetchurl, buildDunePackage }: - -buildDunePackage rec { - pname = "wtf8"; - version = "1.0.1"; - - minimumOCamlVersion = "4.01"; - - src = fetchurl { - url = "https://github.com/flowtype/ocaml-${pname}/releases/download/v${version}/${pname}-${version}.tbz"; - sha256 = "1msg3vycd3k8qqj61sc23qks541cxpb97vrnrvrhjnqxsqnh6ygq"; - }; - - meta = with stdenv.lib; { - homepage = "https://github.com/flowtype/ocaml-wtf8"; - description = "WTF-8 is a superset of UTF-8 that allows unpaired surrogates."; - license = licenses.mit; - maintainers = [ maintainers.eqyiel ]; - }; -} -</programlisting> -</section> |