* Follow our own coding conventions.
This commit is contained in:
parent
f2d65c9c80
commit
93e71e6ab6
3 changed files with 60 additions and 64 deletions
|
@ -43,10 +43,10 @@ is also available as <function>builtins.derivation</function>.</para>
|
||||||
|
|
||||||
<listitem><para>Return the names of the attributes in the
|
<listitem><para>Return the names of the attributes in the
|
||||||
attribute set <replaceable>attrs</replaceable> in a sorted list.
|
attribute set <replaceable>attrs</replaceable> in a sorted list.
|
||||||
For instance, <literal>builtins.attrNames {y = 1; x =
|
For instance, <literal>builtins.attrNames { y = 1; x = "foo";
|
||||||
"foo";}</literal> evaluates to <literal>["x" "y"]</literal>.
|
}</literal> evaluates to <literal>[ "x" "y" ]</literal>. There is
|
||||||
There is no built-in function <function>attrValues</function>, but
|
no built-in function <function>attrValues</function>, but you can
|
||||||
you can easily define it yourself:
|
easily define it yourself:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
attrValues = attrs: map (name: builtins.getAttr name attrs) (builtins.attrNames attrs);</programlisting>
|
attrValues = attrs: map (name: builtins.getAttr name attrs) (builtins.attrNames attrs);</programlisting>
|
||||||
|
@ -442,8 +442,8 @@ x: x + 456</programlisting>
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
builtins.listToAttrs [
|
builtins.listToAttrs
|
||||||
{name = "foo"; value = 123;}
|
[ { name = "foo"; value = 123; }
|
||||||
{ name = "bar"; value = 456; }
|
{ name = "bar"; value = 456; }
|
||||||
]
|
]
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
@ -468,8 +468,8 @@ builtins.listToAttrs [
|
||||||
<programlisting>
|
<programlisting>
|
||||||
map (x: "foo" + x) [ "bar" "bla" "abc" ]</programlisting>
|
map (x: "foo" + x) [ "bar" "bla" "abc" ]</programlisting>
|
||||||
|
|
||||||
evaluates to <literal>["foobar" "foobla"
|
evaluates to <literal>[ "foobar" "foobla" "fooabc"
|
||||||
"fooabc"]</literal>.</para></listitem>
|
]</literal>.</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -493,8 +493,8 @@ map (x: "foo" + x) ["bar" "bla" "abc"]</programlisting>
|
||||||
version is everything following that dash. The result is returned
|
version is everything following that dash. The result is returned
|
||||||
in an attribute set <literal>{ name, version }</literal>. Thus,
|
in an attribute set <literal>{ name, version }</literal>. Thus,
|
||||||
<literal>builtins.parseDrvName "nix-0.12pre12876"</literal>
|
<literal>builtins.parseDrvName "nix-0.12pre12876"</literal>
|
||||||
returns <literal>{name = "nix"; version =
|
returns <literal>{ name = "nix"; version = "0.12pre12876";
|
||||||
"0.12pre12876";}</literal>.</para></listitem>
|
}</literal>.</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
|
@ -891,11 +891,8 @@ propagate attributes). This can be shortened using the
|
||||||
<literal>inherit</literal> keyword. For instance,
|
<literal>inherit</literal> keyword. For instance,
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
let
|
let x = 123; in
|
||||||
x = 123;
|
{ inherit x;
|
||||||
in
|
|
||||||
{
|
|
||||||
inherit x;
|
|
||||||
y = 456;
|
y = 456;
|
||||||
}</programlisting>
|
}</programlisting>
|
||||||
|
|
||||||
|
@ -1482,14 +1479,13 @@ allowedReferences = [];
|
||||||
to know. The value of this attribute should be a list of pairs
|
to know. The value of this attribute should be a list of pairs
|
||||||
<literal>[ <replaceable>name1</replaceable>
|
<literal>[ <replaceable>name1</replaceable>
|
||||||
<replaceable>path1</replaceable> <replaceable>name2</replaceable>
|
<replaceable>path1</replaceable> <replaceable>name2</replaceable>
|
||||||
<replaceable>path2</replaceable>
|
<replaceable>path2</replaceable> <replaceable>...</replaceable>
|
||||||
<replaceable>...</replaceable>]</literal>. The references graph
|
]</literal>. The references graph of each
|
||||||
of each <replaceable>pathN</replaceable> will be stored in a text
|
<replaceable>pathN</replaceable> will be stored in a text file
|
||||||
file <replaceable>nameN</replaceable> in the temporary build
|
<replaceable>nameN</replaceable> in the temporary build directory.
|
||||||
directory. The text files have the format used by
|
The text files have the format used by <command>nix-store
|
||||||
<command>nix-store --register-validity</command> (with the deriver
|
--register-validity</command> (with the deriver fields left
|
||||||
fields left empty). For example, when the following derivation is
|
empty). For example, when the following derivation is built:
|
||||||
built:
|
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
derivation {
|
derivation {
|
||||||
|
|
Loading…
Reference in a new issue