mirror of
https://github.com/NixOS/nix-pills
synced 2024-11-10 13:54:14 +00:00
Update the description of simple.nix in pill 7.7
Solve the discrepancy between the code and its description
This commit is contained in:
parent
b54b78be80
commit
cefdfa8ee1
1 changed files with 13 additions and 11 deletions
|
@ -285,11 +285,10 @@
|
||||||
Finally, it creates the symlink.
|
Finally, it creates the symlink.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
In the first line of <filename>simple.nix</filename>, we have an
|
In the second line of <filename>simple.nix</filename>, we have an
|
||||||
<function>import</function> function call nested in a <code>with</code>
|
<function>import</function> function call. Recall that <function>import</function>
|
||||||
statement. Recall that <function>import</function> accepts one argument, a
|
accepts one argument, a nix file to load. In this case, the contents of
|
||||||
nix file to load. In this case, the contents of the file evaluated to a
|
the file evaluate to a function.
|
||||||
function.
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Afterwards, we call the function with the empty set. We saw this already
|
Afterwards, we call the function with the empty set. We saw this already
|
||||||
|
@ -299,12 +298,15 @@
|
||||||
clearer.
|
clearer.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
The value returned by the nixpkgs function is a set. More specifically,
|
The value returned by the nixpkgs function is a set; more specifically,
|
||||||
it's a set of derivations. Using the <code>with</code> expression we bring
|
it's a set of derivations. Calling <code>import <nixpkgs> {}</code>
|
||||||
them into scope. This is equivalent to the <command>:l <nixpkgs></command>
|
into a <function>let</function>-expression creates the local variable
|
||||||
we used in <application>nix repl</application>; it allows us to easily access derivations
|
<varname>pkgs</varname> and brings it into scope. This has an effect similar to
|
||||||
such as <varname>bash</varname>, <varname>gcc</varname>, and
|
the <command>:l <nixpkgs></command> we used in <application>nix repl</application>,
|
||||||
<varname>coreutils</varname>.
|
in that it allows us to easily access derivations such as <varname>bash</varname>,
|
||||||
|
<varname>gcc</varname>, and <varname>coreutils</varname>, but those derivations
|
||||||
|
will have to be explicitly referred to as members of the <varname>pkgs</varname> set
|
||||||
|
(e.g., <varname>pkgs.bash</varname> instead of just <varname>bash</varname>).
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Below is a revised version of the <filename>simple.nix</filename> file, using the <code>inherit</code> keyword:
|
Below is a revised version of the <filename>simple.nix</filename> file, using the <code>inherit</code> keyword:
|
||||||
|
|
Loading…
Reference in a new issue