nixos: use only URI fragment in manual options links
This commit is contained in:
parent
800c1f15a3
commit
ef37170c6d
@ -30,7 +30,7 @@ enable the Apache HTTP Server with `/webroot` as the document root.
|
|||||||
|
|
||||||
Sets can be nested, and in fact dots in option names are shorthand for
|
Sets can be nested, and in fact dots in option names are shorthand for
|
||||||
defining a set containing another set. For instance,
|
defining a set containing another set. For instance,
|
||||||
[`services.httpd.enable`](options.html#opt-services.httpd.enable) defines a set named
|
[](#opt-services.httpd.enable) defines a set named
|
||||||
`services` that contains a set named `httpd`, which in turn contains an
|
`services` that contains a set named `httpd`, which in turn contains an
|
||||||
option definition named `enable` with value `true`. This means that the
|
option definition named `enable` with value `true`. This means that the
|
||||||
example above can also be written as:
|
example above can also be written as:
|
||||||
|
@ -34,9 +34,9 @@ Here, we include two modules from the same directory, `vpn.nix` and
|
|||||||
```
|
```
|
||||||
|
|
||||||
Note that both `configuration.nix` and `kde.nix` define the option
|
Note that both `configuration.nix` and `kde.nix` define the option
|
||||||
[`environment.systemPackages`](options.html#opt-environment.systemPackages). When multiple modules define an
|
[](#opt-environment.systemPackages). When multiple modules define an
|
||||||
option, NixOS will try to *merge* the definitions. In the case of
|
option, NixOS will try to *merge* the definitions. In the case of
|
||||||
[`environment.systemPackages`](options.html#opt-environment.systemPackages), that's easy: the lists of
|
[](#opt-environment.systemPackages), that's easy: the lists of
|
||||||
packages can simply be concatenated. The value in `configuration.nix` is
|
packages can simply be concatenated. The value in `configuration.nix` is
|
||||||
merged last, so for list-type options, it will appear at the end of the
|
merged last, so for list-type options, it will appear at the end of the
|
||||||
merged list. If you want it to appear first, you can use `mkBefore`:
|
merged list. If you want it to appear first, you can use `mkBefore`:
|
||||||
@ -49,7 +49,7 @@ This causes the `kvm-intel` kernel module to be loaded before any other
|
|||||||
kernel modules.
|
kernel modules.
|
||||||
|
|
||||||
For other types of options, a merge may not be possible. For instance,
|
For other types of options, a merge may not be possible. For instance,
|
||||||
if two modules define [`services.httpd.adminAddr`](options.html#opt-services.httpd.adminAddr),
|
if two modules define [](#opt-services.httpd.adminAddr),
|
||||||
`nixos-rebuild` will give an error:
|
`nixos-rebuild` will give an error:
|
||||||
|
|
||||||
```plain
|
```plain
|
||||||
@ -68,8 +68,8 @@ defined in other modules. This is what the `config` function argument is
|
|||||||
for: it contains the complete, merged system configuration. That is,
|
for: it contains the complete, merged system configuration. That is,
|
||||||
`config` is the result of combining the configurations returned by every
|
`config` is the result of combining the configurations returned by every
|
||||||
module [^1] . For example, here is a module that adds some packages to
|
module [^1] . For example, here is a module that adds some packages to
|
||||||
[`environment.systemPackages`](options.html#opt-environment.systemPackages) only if
|
[](#opt-environment.systemPackages) only if
|
||||||
[`services.xserver.enable`](options.html#opt-services.xserver.enable) is set to `true` somewhere else:
|
[](#opt-services.xserver.enable) is set to `true` somewhere else:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
@ -37,9 +37,9 @@
|
|||||||
<para>
|
<para>
|
||||||
Sets can be nested, and in fact dots in option names are shorthand
|
Sets can be nested, and in fact dots in option names are shorthand
|
||||||
for defining a set containing another set. For instance,
|
for defining a set containing another set. For instance,
|
||||||
<link xlink:href="options.html#opt-services.httpd.enable"><literal>services.httpd.enable</literal></link>
|
<xref linkend="opt-services.httpd.enable" /> defines a set named
|
||||||
defines a set named <literal>services</literal> that contains a set
|
<literal>services</literal> that contains a set named
|
||||||
named <literal>httpd</literal>, which in turn contains an option
|
<literal>httpd</literal>, which in turn contains an option
|
||||||
definition named <literal>enable</literal> with value
|
definition named <literal>enable</literal> with value
|
||||||
<literal>true</literal>. This means that the example above can also
|
<literal>true</literal>. This means that the example above can also
|
||||||
be written as:
|
be written as:
|
||||||
|
@ -40,12 +40,12 @@
|
|||||||
<para>
|
<para>
|
||||||
Note that both <literal>configuration.nix</literal> and
|
Note that both <literal>configuration.nix</literal> and
|
||||||
<literal>kde.nix</literal> define the option
|
<literal>kde.nix</literal> define the option
|
||||||
<link xlink:href="options.html#opt-environment.systemPackages"><literal>environment.systemPackages</literal></link>.
|
<xref linkend="opt-environment.systemPackages" />. When multiple
|
||||||
When multiple modules define an option, NixOS will try to
|
modules define an option, NixOS will try to
|
||||||
<emphasis>merge</emphasis> the definitions. In the case of
|
<emphasis>merge</emphasis> the definitions. In the case of
|
||||||
<link xlink:href="options.html#opt-environment.systemPackages"><literal>environment.systemPackages</literal></link>,
|
<xref linkend="opt-environment.systemPackages" />, that’s easy: the
|
||||||
that’s easy: the lists of packages can simply be concatenated. The
|
lists of packages can simply be concatenated. The value in
|
||||||
value in <literal>configuration.nix</literal> is merged last, so for
|
<literal>configuration.nix</literal> is merged last, so for
|
||||||
list-type options, it will appear at the end of the merged list. If
|
list-type options, it will appear at the end of the merged list. If
|
||||||
you want it to appear first, you can use
|
you want it to appear first, you can use
|
||||||
<literal>mkBefore</literal>:
|
<literal>mkBefore</literal>:
|
||||||
@ -60,7 +60,7 @@ boot.kernelModules = mkBefore [ "kvm-intel" ];
|
|||||||
<para>
|
<para>
|
||||||
For other types of options, a merge may not be possible. For
|
For other types of options, a merge may not be possible. For
|
||||||
instance, if two modules define
|
instance, if two modules define
|
||||||
<link xlink:href="options.html#opt-services.httpd.adminAddr"><literal>services.httpd.adminAddr</literal></link>,
|
<xref linkend="opt-services.httpd.adminAddr" />,
|
||||||
<literal>nixos-rebuild</literal> will give an error:
|
<literal>nixos-rebuild</literal> will give an error:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
@ -89,11 +89,9 @@ services.httpd.adminAddr = pkgs.lib.mkForce "bob@example.org";
|
|||||||
configuration value depends on itself.
|
configuration value depends on itself.
|
||||||
</para>
|
</para>
|
||||||
</footnote> . For example, here is a module that adds some packages
|
</footnote> . For example, here is a module that adds some packages
|
||||||
to
|
to <xref linkend="opt-environment.systemPackages" /> only if
|
||||||
<link xlink:href="options.html#opt-environment.systemPackages"><literal>environment.systemPackages</literal></link>
|
<xref linkend="opt-services.xserver.enable" /> is set to
|
||||||
only if
|
<literal>true</literal> somewhere else:
|
||||||
<link xlink:href="options.html#opt-services.xserver.enable"><literal>services.xserver.enable</literal></link>
|
|
||||||
is set to <literal>true</literal> somewhere else:
|
|
||||||
</para>
|
</para>
|
||||||
<programlisting language="bash">
|
<programlisting language="bash">
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
Loading…
Reference in New Issue
Block a user