diff options
-rw-r--r-- | doc/manual/builtins.xml | 61 | ||||
-rw-r--r-- | doc/manual/nix-env.xml | 2 |
2 files changed, 62 insertions, 1 deletions
diff --git a/doc/manual/builtins.xml b/doc/manual/builtins.xml index 3b6b80324d54..c8470f4986ee 100644 --- a/doc/manual/builtins.xml +++ b/doc/manual/builtins.xml @@ -93,6 +93,23 @@ if builtins ? getEnv then __getEnv "PATH" else ""</programlisting> </varlistentry> + <varlistentry><term><function>builtins.compareVersions</function> + <replaceable>s1</replaceable> <replaceable>s2</replaceable></term> + + <listitem><para>Compare two strings representing versions and + return <literal>-1</literal> if version + <replaceable>s1</replaceable> is older than version + <replaceable>s2</replaceable>, <literal>0</literal> if they are + the same, and <literal>1</literal> if + <replaceable>s1</replaceable> is newer than + <replaceable>s2</replaceable>. The version comparison algorithm + is the same as the one used by <link + linkend="ssec-version-comparisons"><command>nix-env + -u</command></link>.</para></listitem> + + </varlistentry> + + <varlistentry xml:id='builtin-currentSystem'><term><varname>builtins.currentSystem</varname></term> @@ -146,6 +163,16 @@ if builtins ? getEnv then __getEnv "PATH" else ""</programlisting> </varlistentry> + <varlistentry><term><function>builtins.div</function> + <replaceable>e1</replaceable> <replaceable>e2</replaceable></term> + + <listitem><para>Return the quotient of the integers + <replaceable>e1</replaceable> and + <replaceable>e2</replaceable>.</para></listitem> + + </varlistentry> + + <varlistentry><term><function>builtins.filterSource</function> <replaceable>e1</replaceable> <replaceable>e2</replaceable></term> @@ -352,6 +379,15 @@ x: x + 456</programlisting> </varlistentry> + <varlistentry><term><function>builtins.length</function> + <replaceable>e</replaceable></term> + + <listitem><para>Return the length of the list + <replaceable>e</replaceable>.</para></listitem> + + </varlistentry> + + <varlistentry><term><function>builtins.lessThan</function> <replaceable>e1</replaceable> <replaceable>e2</replaceable></term> @@ -408,6 +444,31 @@ map (x: "foo" + x) ["bar" "bla" "abc"]</programlisting> </varlistentry> + <varlistentry><term><function>builtins.mul</function> + <replaceable>e1</replaceable> <replaceable>e2</replaceable></term> + + <listitem><para>Return the product of the integers + <replaceable>e1</replaceable> and + <replaceable>e2</replaceable>.</para></listitem> + + </varlistentry> + + + <varlistentry><term><function>builtins.parseDrvName</function> + <replaceable>s</replaceable></term> + + <listitem><para>Split the string <replaceable>s</replaceable> into + a package name and version. The package name is everything up to + but not including the first dash followed by a digit, and the + version is everything following that dash. The result is returned + in an attribute set <literal>{name, version}</literal>. Thus, + <literal>builtins.parseDrvName "nix-0.12pre12876"</literal> + returns <literal>{name = "nix"; version = + "0.12pre12876";}</literal>.</para></listitem> + + </varlistentry> + + <varlistentry><term><function>builtins.pathExists</function> <replaceable>path</replaceable></term> diff --git a/doc/manual/nix-env.xml b/doc/manual/nix-env.xml index 9f73b2d4c0f7..6bf0513ac277 100644 --- a/doc/manual/nix-env.xml +++ b/doc/manual/nix-env.xml @@ -526,7 +526,7 @@ upgrading `mozilla-1.2' to `mozilla-1.4'</screen> </refsection> -<refsection><title>Versions</title> +<refsection xml:id="ssec-version-comparisons"><title>Versions</title> <para>The upgrade operation determines whether a derivation <varname>y</varname> is an upgrade of a derivation |