3
0
Fork 0
forked from mirrors/nixpkgs

doc: explain where pkgs comes from in writing-modules

The manual mentions how "[config and pkgs] are explained later". Added a link
to where they are explained, and a hint pointing to the NIX_PATH variable.
This commit is contained in:
laikq 2020-12-25 19:38:05 +01:00 committed by tomberek
parent 9004162c26
commit 5c99d24d1e
2 changed files with 8 additions and 4 deletions

View file

@ -16,9 +16,10 @@
The first line (<literal>{ config, pkgs, ... }:</literal>) denotes that this The first line (<literal>{ config, pkgs, ... }:</literal>) denotes that this
is actually a function that takes at least the two arguments is actually a function that takes at least the two arguments
<varname>config</varname> and <varname>pkgs</varname>. (These are explained <varname>config</varname> and <varname>pkgs</varname>. (These are explained
later.) The function returns a <emphasis>set</emphasis> of option definitions later, in chapter <xref linkend="sec-writing-modules" />) The function returns
(<literal>{ <replaceable>...</replaceable> }</literal>). These definitions a <emphasis>set</emphasis> of option definitions (<literal>{
have the form <literal><replaceable>name</replaceable> = <replaceable>...</replaceable> }</literal>). These definitions have the form
<literal><replaceable>name</replaceable> =
<replaceable>value</replaceable></literal>, where <replaceable>value</replaceable></literal>, where
<replaceable>name</replaceable> is the name of an option and <replaceable>name</replaceable> is the name of an option and
<replaceable>value</replaceable> is its value. For example, <replaceable>value</replaceable> is its value. For example,

View file

@ -74,7 +74,10 @@ linkend="sec-configuration-syntax"/>, we saw the following structure
<callout arearefs='module-syntax-1'> <callout arearefs='module-syntax-1'>
<para> <para>
This line makes the current Nix expression a function. The variable This line makes the current Nix expression a function. The variable
<varname>pkgs</varname> contains Nixpkgs, while <varname>config</varname> <varname>pkgs</varname> contains Nixpkgs (by default, it takes the
<varname>nixpkgs</varname> entry of <envar>NIX_PATH</envar>, see the <link
xlink:href="https://nixos.org/manual/nix/stable/#sec-common-env">Nix
manual</link> for further details), while <varname>config</varname>
contains the full system configuration. This line can be omitted if there contains the full system configuration. This line can be omitted if there
is no reference to <varname>pkgs</varname> and <varname>config</varname> is no reference to <varname>pkgs</varname> and <varname>config</varname>
inside the module. inside the module.