* Follow our own coding conventions.

This commit is contained in:
Eelco Dolstra 2011-12-30 17:39:03 +00:00
parent f2d65c9c80
commit 93e71e6ab6
3 changed files with 60 additions and 64 deletions

View File

@ -43,10 +43,10 @@ is also available as <function>builtins.derivation</function>.</para>
<listitem><para>Return the names of the attributes in the
attribute set <replaceable>attrs</replaceable> in a sorted list.
For instance, <literal>builtins.attrNames {y = 1; x =
"foo";}</literal> evaluates to <literal>["x" "y"]</literal>.
There is no built-in function <function>attrValues</function>, but
you can easily define it yourself:
For instance, <literal>builtins.attrNames { y = 1; x = "foo";
}</literal> evaluates to <literal>[ "x" "y" ]</literal>. There is
no built-in function <function>attrValues</function>, but you can
easily define it yourself:
<programlisting>
attrValues = attrs: map (name: builtins.getAttr name attrs) (builtins.attrNames attrs);</programlisting>
@ -442,8 +442,8 @@ x: x + 456</programlisting>
Example:
<programlisting>
builtins.listToAttrs [
{name = "foo"; value = 123;}
builtins.listToAttrs
[ { name = "foo"; value = 123; }
{ name = "bar"; value = 456; }
]
</programlisting>
@ -468,8 +468,8 @@ builtins.listToAttrs [
<programlisting>
map (x: "foo" + x) [ "bar" "bla" "abc" ]</programlisting>
evaluates to <literal>["foobar" "foobla"
"fooabc"]</literal>.</para></listitem>
evaluates to <literal>[ "foobar" "foobla" "fooabc"
]</literal>.</para></listitem>
</varlistentry>
@ -493,8 +493,8 @@ map (x: "foo" + x) ["bar" "bla" "abc"]</programlisting>
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>
returns <literal>{ name = "nix"; version = "0.12pre12876";
}</literal>.</para></listitem>
</varlistentry>

View File

@ -891,11 +891,8 @@ propagate attributes). This can be shortened using the
<literal>inherit</literal> keyword. For instance,
<programlisting>
let
x = 123;
in
{
inherit x;
let x = 123; in
{ inherit x;
y = 456;
}</programlisting>
@ -1482,14 +1479,13 @@ allowedReferences = [];
to know. The value of this attribute should be a list of pairs
<literal>[ <replaceable>name1</replaceable>
<replaceable>path1</replaceable> <replaceable>name2</replaceable>
<replaceable>path2</replaceable>
<replaceable>...</replaceable>]</literal>. The references graph
of each <replaceable>pathN</replaceable> will be stored in a text
file <replaceable>nameN</replaceable> in the temporary build
directory. The text files have the format used by
<command>nix-store --register-validity</command> (with the deriver
fields left empty). For example, when the following derivation is
built:
<replaceable>path2</replaceable> <replaceable>...</replaceable>
]</literal>. The references graph of each
<replaceable>pathN</replaceable> will be stored in a text file
<replaceable>nameN</replaceable> in the temporary build directory.
The text files have the format used by <command>nix-store
--register-validity</command> (with the deriver fields left
empty). For example, when the following derivation is built:
<programlisting>
derivation {