diff options
author | Wael Nasreddine <wael.nasreddine@gmail.com> | 2019-03-08 21:07:11 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-08 21:07:11 -0800 |
commit | a7f4fd00149d30651d1b16f708a95e5b76950d63 (patch) | |
tree | 188709a40edd03fac4b2770e4f128d049696549c /doc/functions/trivial-builders.xml | |
parent | b7ebfec61f2f93e922ecdff60ac80a08e911b443 (diff) | |
download | nixpkgs-a7f4fd00149d30651d1b16f708a95e5b76950d63.tar nixpkgs-a7f4fd00149d30651d1b16f708a95e5b76950d63.tar.gz nixpkgs-a7f4fd00149d30651d1b16f708a95e5b76950d63.tar.bz2 nixpkgs-a7f4fd00149d30651d1b16f708a95e5b76950d63.tar.lz nixpkgs-a7f4fd00149d30651d1b16f708a95e5b76950d63.tar.xz nixpkgs-a7f4fd00149d30651d1b16f708a95e5b76950d63.tar.zst nixpkgs-a7f4fd00149d30651d1b16f708a95e5b76950d63.zip |
doc: format the documentation (#57102)
Diffstat (limited to 'doc/functions/trivial-builders.xml')
-rw-r--r-- | doc/functions/trivial-builders.xml | 111 |
1 files changed, 50 insertions, 61 deletions
diff --git a/doc/functions/trivial-builders.xml b/doc/functions/trivial-builders.xml index 92a07aedb5b..1fd92ecfe26 100644 --- a/doc/functions/trivial-builders.xml +++ b/doc/functions/trivial-builders.xml @@ -5,12 +5,11 @@ <title>Trivial builders</title> <para> - Nixpkgs provides a couple of functions that help with building - derivations. The most important one, - <function>stdenv.mkDerivation</function>, has already been - documented above. The following functions wrap - <function>stdenv.mkDerivation</function>, making it easier to use - in certain cases. + Nixpkgs provides a couple of functions that help with building derivations. + The most important one, <function>stdenv.mkDerivation</function>, has already + been documented above. The following functions wrap + <function>stdenv.mkDerivation</function>, making it easier to use in certain + cases. </para> <variablelist> @@ -19,26 +18,23 @@ <literal>runCommand</literal> </term> <listitem> - <para> - This takes three arguments, <literal>name</literal>, - <literal>env</literal>, and <literal>buildCommand</literal>. - <literal>name</literal> is just the name that Nix will append - to the store path in the same way that - <literal>stdenv.mkDerivation</literal> uses its - <literal>name</literal> attribute. <literal>env</literal> is an - attribute set specifying environment variables that will be set - for this derivation. These attributes are then passed to the - wrapped <literal>stdenv.mkDerivation</literal>. - <literal>buildCommand</literal> specifies the commands that - will be run to create this derivation. Note that you will need - to create <literal>$out</literal> for Nix to register the - command as successful. - </para> - <para> - An example of using <literal>runCommand</literal> is provided - below. - </para> - <programlisting> + <para> + This takes three arguments, <literal>name</literal>, + <literal>env</literal>, and <literal>buildCommand</literal>. + <literal>name</literal> is just the name that Nix will append to the store + path in the same way that <literal>stdenv.mkDerivation</literal> uses its + <literal>name</literal> attribute. <literal>env</literal> is an attribute + set specifying environment variables that will be set for this derivation. + These attributes are then passed to the wrapped + <literal>stdenv.mkDerivation</literal>. <literal>buildCommand</literal> + specifies the commands that will be run to create this derivation. Note + that you will need to create <literal>$out</literal> for Nix to register + the command as successful. + </para> + <para> + An example of using <literal>runCommand</literal> is provided below. + </para> +<programlisting> (import <nixpkgs> {}).runCommand "my-example" {} '' echo My example command is running @@ -65,41 +61,35 @@ <literal>runCommandCC</literal> </term> <listitem> - <para> - This works just like <literal>runCommand</literal>. The only - difference is that it also provides a C compiler in - <literal>buildCommand</literal>’s environment. To minimize your - dependencies, you should only use this if you are sure you will - need a C compiler as part of running your command. + <para> + This works just like <literal>runCommand</literal>. The only difference is + that it also provides a C compiler in <literal>buildCommand</literal>’s + environment. To minimize your dependencies, you should only use this if + you are sure you will need a C compiler as part of running your command. </para> </listitem> </varlistentry> <varlistentry> <term> - <literal>writeTextFile</literal>, <literal>writeText</literal>, - <literal>writeTextDir</literal>, <literal>writeScript</literal>, - <literal>writeScriptBin</literal> + <literal>writeTextFile</literal>, <literal>writeText</literal>, <literal>writeTextDir</literal>, <literal>writeScript</literal>, <literal>writeScriptBin</literal> </term> <listitem> - <para> - These functions write <literal>text</literal> to the Nix store. - This is useful for creating scripts from Nix expressions. - <literal>writeTextFile</literal> takes an attribute set and - expects two arguments, <literal>name</literal> and - <literal>text</literal>. <literal>name</literal> corresponds to - the name used in the Nix store path. <literal>text</literal> - will be the contents of the file. You can also set - <literal>executable</literal> to true to make this file have - the executable bit set. - </para> - <para> - Many more commands wrap <literal>writeTextFile</literal> - including <literal>writeText</literal>, - <literal>writeTextDir</literal>, - <literal>writeScript</literal>, and - <literal>writeScriptBin</literal>. These are convenience - functions over <literal>writeTextFile</literal>. - </para> + <para> + These functions write <literal>text</literal> to the Nix store. This is + useful for creating scripts from Nix expressions. + <literal>writeTextFile</literal> takes an attribute set and expects two + arguments, <literal>name</literal> and <literal>text</literal>. + <literal>name</literal> corresponds to the name used in the Nix store + path. <literal>text</literal> will be the contents of the file. You can + also set <literal>executable</literal> to true to make this file have the + executable bit set. + </para> + <para> + Many more commands wrap <literal>writeTextFile</literal> including + <literal>writeText</literal>, <literal>writeTextDir</literal>, + <literal>writeScript</literal>, and <literal>writeScriptBin</literal>. + These are convenience functions over <literal>writeTextFile</literal>. + </para> </listitem> </varlistentry> <varlistentry> @@ -109,16 +99,15 @@ <listitem> <para> This can be used to put many derivations into the same directory - structure. It works by creating a new derivation and adding - symlinks to each of the paths listed. It expects two arguments, + structure. It works by creating a new derivation and adding symlinks to + each of the paths listed. It expects two arguments, <literal>name</literal>, and <literal>paths</literal>. - <literal>name</literal> is the name used in the Nix store path - for the created derivation. <literal>paths</literal> is a list of - paths that will be symlinked. These paths can be to Nix store - derivations or any other subdirectory contained within. + <literal>name</literal> is the name used in the Nix store path for the + created derivation. <literal>paths</literal> is a list of paths that will + be symlinked. These paths can be to Nix store derivations or any other + subdirectory contained within. </para> </listitem> </varlistentry> </variablelist> - </section> |