Merge pull request #136909 from ncfavier/cleanup-defaults-examples

nixos/doc: clean up defaults and examples
This commit is contained in:
Robert Hensing 2021-10-04 20:37:42 +02:00 committed by GitHub
commit 0699530f08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
587 changed files with 1661 additions and 1579 deletions

View File

@ -123,8 +123,8 @@ let
inherit (self.options) isOption mkEnableOption mkSinkUndeclaredOptions inherit (self.options) isOption mkEnableOption mkSinkUndeclaredOptions
mergeDefaultOption mergeOneOption mergeEqualOption getValues mergeDefaultOption mergeOneOption mergeEqualOption getValues
getFiles optionAttrSetToDocList optionAttrSetToDocList' getFiles optionAttrSetToDocList optionAttrSetToDocList'
scrubOptionValue literalExample showOption showFiles scrubOptionValue literalExpression literalExample literalDocBook
unknownModule mkOption; showOption showFiles unknownModule mkOption;
inherit (self.types) isType setType defaultTypeMerge defaultFunctor inherit (self.types) isType setType defaultTypeMerge defaultFunctor
isOptionType mkOptionType; isOptionType mkOptionType;
inherit (self.asserts) inherit (self.asserts)

View File

@ -54,7 +54,7 @@ rec {
Example: Example:
mkOption { } // => { _type = "option"; } mkOption { } // => { _type = "option"; }
mkOption { defaultText = "foo"; } // => { _type = "option"; defaultText = "foo"; } mkOption { default = "foo"; } // => { _type = "option"; default = "foo"; }
*/ */
mkOption = mkOption =
{ {
@ -212,11 +212,25 @@ rec {
else x; else x;
/* For use in the `example` option attribute. It causes the given /* For use in the `defaultText` and `example` option attributes. Causes the
text to be included verbatim in documentation. This is necessary given string to be rendered verbatim in the documentation as Nix code. This
for example values that are not simple values, e.g., functions. is necessary for complex values, e.g. functions, or values that depend on
other values or packages.
*/ */
literalExample = text: { _type = "literalExample"; inherit text; }; literalExpression = text:
if ! isString text then throw "literalExpression expects a string."
else { _type = "literalExpression"; inherit text; };
literalExample = lib.warn "literalExample is deprecated, use literalExpression instead, or use literalDocBook for a non-Nix description." literalExpression;
/* For use in the `defaultText` and `example` option attributes. Causes the
given DocBook text to be inserted verbatim in the documentation, for when
a `literalExpression` would be too hard to read.
*/
literalDocBook = text:
if ! isString text then throw "literalDocBook expects a string."
else { _type = "literalDocBook"; inherit text; };
# Helper functions. # Helper functions.

View File

@ -38,9 +38,19 @@ The function `mkOption` accepts the following arguments.
of the module will have to define the value of the option, otherwise of the module will have to define the value of the option, otherwise
an error will be thrown. an error will be thrown.
`defaultText`
: A textual representation of the default value to be rendered verbatim in
the manual. Useful if the default value is a complex expression or depends
on other values or packages.
Use `lib.literalExpression` for a Nix expression, `lib.literalDocBook` for
a plain English description in DocBook format.
`example` `example`
: An example value that will be shown in the NixOS manual. : An example value that will be shown in the NixOS manual.
You can use `lib.literalExpression` and `lib.literalDocBook` in the same way
as in `defaultText`.
`description` `description`

View File

@ -57,13 +57,31 @@ options = {
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<literal>defaultText</literal>
</term>
<listitem>
<para>
A textual representation of the default value to be rendered
verbatim in the manual. Useful if the default value is a
complex expression or depends on other values or packages. Use
<literal>lib.literalExpression</literal> for a Nix expression,
<literal>lib.literalDocBook</literal> for a plain English
description in DocBook format.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<literal>example</literal> <literal>example</literal>
</term> </term>
<listitem> <listitem>
<para> <para>
An example value that will be shown in the NixOS manual. An example value that will be shown in the NixOS manual. You
can use <literal>lib.literalExpression</literal> and
<literal>lib.literalDocBook</literal> in the same way as in
<literal>defaultText</literal>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -54,7 +54,7 @@
<para> <para>
<emphasis>Default:</emphasis> <emphasis>Default:</emphasis>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<xsl:apply-templates select="attr[@name = 'default']" mode="top" /> <xsl:apply-templates select="attr[@name = 'default']/*" mode="top" />
</para> </para>
</xsl:if> </xsl:if>
@ -62,14 +62,7 @@
<para> <para>
<emphasis>Example:</emphasis> <emphasis>Example:</emphasis>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<xsl:choose> <xsl:apply-templates select="attr[@name = 'example']/*" mode="top" />
<xsl:when test="attr[@name = 'example']/attrs[attr[@name = '_type' and string[@value = 'literalExample']]]">
<programlisting><xsl:value-of select="attr[@name = 'example']/attrs/attr[@name = 'text']/string/@value" /></programlisting>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="attr[@name = 'example']" mode="top" />
</xsl:otherwise>
</xsl:choose>
</para> </para>
</xsl:if> </xsl:if>
@ -107,20 +100,37 @@
</xsl:template> </xsl:template>
<xsl:template match="*" mode="top"> <xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalExpression']]]" mode = "top">
<xsl:choose> <xsl:choose>
<xsl:when test="string[contains(@value, '&#010;')]"> <xsl:when test="contains(attr[@name = 'text']/string/@value, '&#010;')">
<programlisting> <programlisting><xsl:value-of select="attr[@name = 'text']/string/@value" /></programlisting>
<xsl:text>''
</xsl:text><xsl:value-of select='str:replace(string/@value, "${", "&apos;&apos;${")' /><xsl:text>''</xsl:text></programlisting>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<literal><xsl:apply-templates /></literal> <literal><xsl:value-of select="attr[@name = 'text']/string/@value" /></literal>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalDocBook']]]" mode = "top">
<xsl:value-of disable-output-escaping="yes" select="attr[@name = 'text']/string/@value" />
</xsl:template>
<xsl:template match="string[contains(@value, '&#010;')]" mode="top">
<programlisting>
<xsl:text>''&#010;</xsl:text>
<xsl:value-of select='str:replace(str:replace(@value, "&apos;&apos;", "&apos;&apos;&apos;"), "${", "&apos;&apos;${")' />
<xsl:text>''</xsl:text>
</programlisting>
</xsl:template>
<xsl:template match="*" mode="top">
<literal><xsl:apply-templates select="." /></literal>
</xsl:template>
<xsl:template match="null"> <xsl:template match="null">
<xsl:text>null</xsl:text> <xsl:text>null</xsl:text>
</xsl:template> </xsl:template>
@ -129,10 +139,10 @@
<xsl:template match="string"> <xsl:template match="string">
<xsl:choose> <xsl:choose>
<xsl:when test="(contains(@value, '&quot;') or contains(@value, '\')) and not(contains(@value, '&#010;'))"> <xsl:when test="(contains(@value, '&quot;') or contains(@value, '\')) and not(contains(@value, '&#010;'))">
<xsl:text>''</xsl:text><xsl:value-of select='str:replace(@value, "${", "&apos;&apos;${")' /><xsl:text>''</xsl:text> <xsl:text>''</xsl:text><xsl:value-of select='str:replace(str:replace(@value, "&apos;&apos;", "&apos;&apos;&apos;"), "${", "&apos;&apos;${")' /><xsl:text>''</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>"</xsl:text><xsl:value-of select="str:replace(str:replace(str:replace(str:replace(@value, '\', '\\'), '&quot;', '\&quot;'), '&#010;', '\n'), '$', '\$')" /><xsl:text>"</xsl:text> <xsl:text>"</xsl:text><xsl:value-of select="str:replace(str:replace(str:replace(str:replace(@value, '\', '\\'), '&quot;', '\&quot;'), '&#010;', '\n'), '${', '\${')" /><xsl:text>"</xsl:text>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
@ -163,7 +173,7 @@
</xsl:template> </xsl:template>
<xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalExample']]]"> <xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalExpression']]]">
<xsl:value-of select="attr[@name = 'text']/string/@value" /> <xsl:value-of select="attr[@name = 'text']/string/@value" />
</xsl:template> </xsl:template>

View File

@ -27,7 +27,7 @@ in {
}; };
contents = mkOption { contents = mkOption {
example = literalExample '' example = literalExpression ''
[ { source = pkgs.memtest86 + "/memtest.bin"; [ { source = pkgs.memtest86 + "/memtest.bin";
target = "boot/memtest.bin"; target = "boot/memtest.bin";
} }

View File

@ -61,7 +61,7 @@ in
fonts = mkOption { fonts = mkOption {
type = types.listOf types.path; type = types.listOf types.path;
default = []; default = [];
example = literalExample "[ pkgs.dejavu_fonts ]"; example = literalExpression "[ pkgs.dejavu_fonts ]";
description = "List of primary font paths."; description = "List of primary font paths.";
}; };

View File

@ -14,7 +14,7 @@ with lib;
allLocales = any (x: x == "all") config.i18n.supportedLocales; allLocales = any (x: x == "all") config.i18n.supportedLocales;
locales = config.i18n.supportedLocales; locales = config.i18n.supportedLocales;
}; };
example = literalExample "pkgs.glibcLocales"; example = literalExpression "pkgs.glibcLocales";
description = '' description = ''
Customized pkg.glibcLocales package. Customized pkg.glibcLocales package.

View File

@ -83,8 +83,8 @@ in {
kerberos = mkOption { kerberos = mkOption {
type = types.package; type = types.package;
default = pkgs.krb5Full; default = pkgs.krb5Full;
defaultText = "pkgs.krb5Full"; defaultText = literalExpression "pkgs.krb5Full";
example = literalExample "pkgs.heimdal"; example = literalExpression "pkgs.heimdal";
description = '' description = ''
The Kerberos implementation that will be present in The Kerberos implementation that will be present in
<literal>environment.systemPackages</literal> after enabling this <literal>environment.systemPackages</literal> after enabling this
@ -96,7 +96,7 @@ in {
type = with types; either attrs lines; type = with types; either attrs lines;
default = {}; default = {};
apply = attrs: filterEmbeddedMetadata attrs; apply = attrs: filterEmbeddedMetadata attrs;
example = literalExample '' example = literalExpression ''
{ {
default_realm = "ATHENA.MIT.EDU"; default_realm = "ATHENA.MIT.EDU";
}; };
@ -109,7 +109,7 @@ in {
realms = mkOption { realms = mkOption {
type = with types; either attrs lines; type = with types; either attrs lines;
default = {}; default = {};
example = literalExample '' example = literalExpression ''
{ {
"ATHENA.MIT.EDU" = { "ATHENA.MIT.EDU" = {
admin_server = "athena.mit.edu"; admin_server = "athena.mit.edu";
@ -127,7 +127,7 @@ in {
domain_realm = mkOption { domain_realm = mkOption {
type = with types; either attrs lines; type = with types; either attrs lines;
default = {}; default = {};
example = literalExample '' example = literalExpression ''
{ {
"example.com" = "EXAMPLE.COM"; "example.com" = "EXAMPLE.COM";
".example.com" = "EXAMPLE.COM"; ".example.com" = "EXAMPLE.COM";
@ -142,7 +142,7 @@ in {
capaths = mkOption { capaths = mkOption {
type = with types; either attrs lines; type = with types; either attrs lines;
default = {}; default = {};
example = literalExample '' example = literalExpression ''
{ {
"ATHENA.MIT.EDU" = { "ATHENA.MIT.EDU" = {
"EXAMPLE.COM" = "."; "EXAMPLE.COM" = ".";
@ -161,7 +161,7 @@ in {
appdefaults = mkOption { appdefaults = mkOption {
type = with types; either attrs lines; type = with types; either attrs lines;
default = {}; default = {};
example = literalExample '' example = literalExpression ''
{ {
pam = { pam = {
debug = false; debug = false;
@ -182,7 +182,7 @@ in {
plugins = mkOption { plugins = mkOption {
type = with types; either attrs lines; type = with types; either attrs lines;
default = {}; default = {};
example = literalExample '' example = literalExpression ''
{ {
ccselect = { ccselect = {
disable = "k5identity"; disable = "k5identity";

View File

@ -21,7 +21,7 @@ in
networking.hosts = lib.mkOption { networking.hosts = lib.mkOption {
type = types.attrsOf (types.listOf types.str); type = types.attrsOf (types.listOf types.str);
example = literalExample '' example = literalExpression ''
{ {
"127.0.0.1" = [ "foo.bar.baz" ]; "127.0.0.1" = [ "foo.bar.baz" ];
"192.168.0.2" = [ "fileserver.local" "nameserver.local" ]; "192.168.0.2" = [ "fileserver.local" "nameserver.local" ];
@ -34,8 +34,8 @@ in
networking.hostFiles = lib.mkOption { networking.hostFiles = lib.mkOption {
type = types.listOf types.path; type = types.listOf types.path;
defaultText = lib.literalExample "Hosts from `networking.hosts` and `networking.extraHosts`"; defaultText = literalDocBook "Hosts from <option>networking.hosts</option> and <option>networking.extraHosts</option>";
example = lib.literalExample ''[ "''${pkgs.my-blocklist-package}/share/my-blocklist/hosts" ]''; example = literalExpression ''[ "''${pkgs.my-blocklist-package}/share/my-blocklist/hosts" ]'';
description = '' description = ''
Files that should be concatenated together to form <filename>/etc/hosts</filename>. Files that should be concatenated together to form <filename>/etc/hosts</filename>.
''; '';

View File

@ -35,7 +35,7 @@ in
powerUpCommands = mkOption { powerUpCommands = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
example = literalExample '' example = literalExpression ''
"''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda" "''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"
''; '';
description = description =
@ -49,7 +49,7 @@ in
powerDownCommands = mkOption { powerDownCommands = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
example = literalExample '' example = literalExpression ''
"''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda" "''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"
''; '';
description = description =

View File

@ -149,8 +149,8 @@ in {
default = if config.services.jack.jackd.enable default = if config.services.jack.jackd.enable
then pkgs.pulseaudioFull then pkgs.pulseaudioFull
else pkgs.pulseaudio; else pkgs.pulseaudio;
defaultText = "pkgs.pulseaudio"; defaultText = literalExpression "pkgs.pulseaudio";
example = literalExample "pkgs.pulseaudioFull"; example = literalExpression "pkgs.pulseaudioFull";
description = '' description = ''
The PulseAudio derivation to use. This can be used to enable The PulseAudio derivation to use. This can be used to enable
features (such as JACK support, Bluetooth) via the features (such as JACK support, Bluetooth) via the
@ -161,7 +161,7 @@ in {
extraModules = mkOption { extraModules = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = []; default = [];
example = literalExample "[ pkgs.pulseaudio-modules-bt ]"; example = literalExpression "[ pkgs.pulseaudio-modules-bt ]";
description = '' description = ''
Extra pulseaudio modules to use. This is intended for out-of-tree Extra pulseaudio modules to use. This is intended for out-of-tree
pulseaudio modules like extra bluetooth codecs. pulseaudio modules like extra bluetooth codecs.
@ -184,7 +184,7 @@ in {
type = types.attrsOf types.unspecified; type = types.attrsOf types.unspecified;
default = {}; default = {};
description = "Config of the pulse daemon. See <literal>man pulse-daemon.conf</literal>."; description = "Config of the pulse daemon. See <literal>man pulse-daemon.conf</literal>.";
example = literalExample ''{ realtime-scheduling = "yes"; }''; example = literalExpression ''{ realtime-scheduling = "yes"; }'';
}; };
}; };
@ -204,7 +204,7 @@ in {
allowedIpRanges = mkOption { allowedIpRanges = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
example = literalExample ''[ "127.0.0.1" "192.168.1.0/24" ]''; example = literalExpression ''[ "127.0.0.1" "192.168.1.0/24" ]'';
description = '' description = ''
A list of IP subnets that are allowed to stream to the server. A list of IP subnets that are allowed to stream to the server.
''; '';

View File

@ -136,10 +136,8 @@ in
environment.binsh = mkOption { environment.binsh = mkOption {
default = "${config.system.build.binsh}/bin/sh"; default = "${config.system.build.binsh}/bin/sh";
defaultText = "\${config.system.build.binsh}/bin/sh"; defaultText = literalExpression ''"''${config.system.build.binsh}/bin/sh"'';
example = literalExample '' example = literalExpression ''"''${pkgs.dash}/bin/dash"'';
"''${pkgs.dash}/bin/dash"
'';
type = types.path; type = types.path;
visible = false; visible = false;
description = '' description = ''
@ -152,7 +150,7 @@ in
environment.shells = mkOption { environment.shells = mkOption {
default = []; default = [];
example = literalExample "[ pkgs.bashInteractive pkgs.zsh ]"; example = literalExpression "[ pkgs.bashInteractive pkgs.zsh ]";
description = '' description = ''
A list of permissible login shells for user accounts. A list of permissible login shells for user accounts.
No need to mention <literal>/bin/sh</literal> No need to mention <literal>/bin/sh</literal>

View File

@ -22,7 +22,7 @@ in
boot.kernel.sysctl = mkOption { boot.kernel.sysctl = mkOption {
default = {}; default = {};
example = literalExample '' example = literalExpression ''
{ "net.ipv4.tcp_syncookies" = false; "vm.swappiness" = 60; } { "net.ipv4.tcp_syncookies" = false; "vm.swappiness" = 60; }
''; '';
type = types.attrsOf sysctlOption; type = types.attrsOf sysctlOption;

View File

@ -58,7 +58,7 @@ in
systemPackages = mkOption { systemPackages = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = []; default = [];
example = literalExample "[ pkgs.firefox pkgs.thunderbird ]"; example = literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
description = '' description = ''
The set of packages that appear in The set of packages that appear in
/run/current-system/sw. These packages are /run/current-system/sw. These packages are
@ -73,9 +73,9 @@ in
defaultPackages = mkOption { defaultPackages = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = defaultPackages; default = defaultPackages;
example = literalExample "[]"; example = [];
description = '' description = ''
Set of default packages that aren't strictly neccessary Set of default packages that aren't strictly necessary
for a running system, entries can be removed for a more for a running system, entries can be removed for a more
minimal NixOS installation. minimal NixOS installation.

View File

@ -19,7 +19,7 @@ in {
environment.unixODBCDrivers = mkOption { environment.unixODBCDrivers = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = []; default = [];
example = literalExample "with pkgs.unixODBCDrivers; [ sqlite psql ]"; example = literalExpression "with pkgs.unixODBCDrivers; [ sqlite psql ]";
description = '' description = ''
Specifies Unix ODBC drivers to be registered in Specifies Unix ODBC drivers to be registered in
<filename>/etc/odbcinst.ini</filename>. You may also want to <filename>/etc/odbcinst.ini</filename>. You may also want to

View File

@ -165,8 +165,8 @@ let
shell = mkOption { shell = mkOption {
type = types.nullOr (types.either types.shellPackage (passwdEntry types.path)); type = types.nullOr (types.either types.shellPackage (passwdEntry types.path));
default = pkgs.shadow; default = pkgs.shadow;
defaultText = "pkgs.shadow"; defaultText = literalExpression "pkgs.shadow";
example = literalExample "pkgs.bashInteractive"; example = literalExpression "pkgs.bashInteractive";
description = '' description = ''
The path to the user's shell. Can use shell derivations, The path to the user's shell. Can use shell derivations,
like <literal>pkgs.bashInteractive</literal>. Dont like <literal>pkgs.bashInteractive</literal>. Dont
@ -291,7 +291,7 @@ let
packages = mkOption { packages = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = []; default = [];
example = literalExample "[ pkgs.firefox pkgs.thunderbird ]"; example = literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
description = '' description = ''
The set of packages that should be made available to the user. The set of packages that should be made available to the user.
This is in contrast to <option>environment.systemPackages</option>, This is in contrast to <option>environment.systemPackages</option>,

View File

@ -37,7 +37,7 @@ in
default = { }; default = { };
# Example taken from the manpage # Example taken from the manpage
example = literalExample '' example = literalExpression ''
{ {
screencast = { screencast = {
output_name = "HDMI-A-1"; output_name = "HDMI-A-1";

View File

@ -27,7 +27,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.ckb-next; default = pkgs.ckb-next;
defaultText = "pkgs.ckb-next"; defaultText = literalExpression "pkgs.ckb-next";
description = '' description = ''
The package implementing the Corsair keyboard/mouse driver. The package implementing the Corsair keyboard/mouse driver.
''; '';

View File

@ -21,7 +21,7 @@ let
each .dtb file matching "compatible" of the overlay. each .dtb file matching "compatible" of the overlay.
''; '';
default = null; default = null;
example = literalExample "./dts/overlays.dts"; example = literalExpression "./dts/overlays.dts";
}; };
dtsText = mkOption { dtsText = mkOption {
@ -31,7 +31,7 @@ let
Literal DTS contents, overlay is applied to Literal DTS contents, overlay is applied to
each .dtb file matching "compatible" of the overlay. each .dtb file matching "compatible" of the overlay.
''; '';
example = literalExample '' example = ''
/dts-v1/; /dts-v1/;
/plugin/; /plugin/;
/ { / {
@ -125,8 +125,8 @@ in
kernelPackage = mkOption { kernelPackage = mkOption {
default = config.boot.kernelPackages.kernel; default = config.boot.kernelPackages.kernel;
defaultText = "config.boot.kernelPackages.kernel"; defaultText = literalExpression "config.boot.kernelPackages.kernel";
example = literalExample "pkgs.linux_latest"; example = literalExpression "pkgs.linux_latest";
type = types.path; type = types.path;
description = '' description = ''
Kernel package containing the base device-tree (.dtb) to boot. Uses Kernel package containing the base device-tree (.dtb) to boot. Uses
@ -156,7 +156,7 @@ in
overlays = mkOption { overlays = mkOption {
default = []; default = [];
example = literalExample '' example = literalExpression ''
[ [
{ name = "pps"; dtsFile = ./dts/pps.dts; } { name = "pps"; dtsFile = ./dts/pps.dts; }
{ name = "spi"; { name = "spi";

View File

@ -19,7 +19,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.digitalbitbox; default = pkgs.digitalbitbox;
defaultText = "pkgs.digitalbitbox"; defaultText = literalExpression "pkgs.digitalbitbox";
description = "The Digital Bitbox package to use. This can be used to install a package with udev rules that differ from the defaults."; description = "The Digital Bitbox package to use. This can be used to install a package with udev rules that differ from the defaults.";
}; };
}; };

View File

@ -89,7 +89,7 @@ in
extraPackages = mkOption { extraPackages = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = []; default = [];
example = literalExample "with pkgs; [ vaapiIntel libvdpau-va-gl vaapiVdpau intel-ocl ]"; example = literalExpression "with pkgs; [ vaapiIntel libvdpau-va-gl vaapiVdpau intel-ocl ]";
description = '' description = ''
Additional packages to add to OpenGL drivers. This can be used Additional packages to add to OpenGL drivers. This can be used
to add OpenCL drivers, VA-API/VDPAU drivers etc. to add OpenCL drivers, VA-API/VDPAU drivers etc.
@ -99,7 +99,7 @@ in
extraPackages32 = mkOption { extraPackages32 = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = []; default = [];
example = literalExample "with pkgs.pkgsi686Linux; [ vaapiIntel libvdpau-va-gl vaapiVdpau ]"; example = literalExpression "with pkgs.pkgsi686Linux; [ vaapiIntel libvdpau-va-gl vaapiVdpau ]";
description = '' description = ''
Additional packages to add to 32-bit OpenGL drivers on Additional packages to add to 32-bit OpenGL drivers on
64-bit systems. Used when <option>driSupport32Bit</option> is 64-bit systems. Used when <option>driSupport32Bit</option> is

View File

@ -29,7 +29,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.opentabletdriver; default = pkgs.opentabletdriver;
defaultText = "pkgs.opentabletdriver"; defaultText = literalExpression "pkgs.opentabletdriver";
description = '' description = ''
OpenTabletDriver derivation to use. OpenTabletDriver derivation to use.
''; '';

View File

@ -72,10 +72,10 @@ in {
}; };
deviceUri = mkOption { deviceUri = mkOption {
type = types.str; type = types.str;
example = [ example = literalExpression ''
"ipp://printserver.local/printers/BrotherHL_Workroom" "ipp://printserver.local/printers/BrotherHL_Workroom"
"usb://HP/DESKJET%20940C?serial=CN16E6C364BH" "usb://HP/DESKJET%20940C?serial=CN16E6C364BH"
]; '';
description = '' description = ''
How to reach the printer. How to reach the printer.
<command>lpinfo -v</command> shows a list of supported device URIs and schemes. <command>lpinfo -v</command> shows a list of supported device URIs and schemes.
@ -83,8 +83,8 @@ in {
}; };
model = mkOption { model = mkOption {
type = types.str; type = types.str;
example = literalExample '' example = literalExpression ''
gutenprint.''${lib.versions.majorMinor (lib.getVersion pkgs.gutenprint)}://brother-hl-5140/expert "gutenprint.''${lib.versions.majorMinor (lib.getVersion pkgs.gutenprint)}://brother-hl-5140/expert"
''; '';
description = '' description = ''
Location of the ppd driver file for the printer. Location of the ppd driver file for the printer.

View File

@ -39,7 +39,7 @@ in
enable = mkEnableOption "SATA drive timeouts"; enable = mkEnableOption "SATA drive timeouts";
deciSeconds = mkOption { deciSeconds = mkOption {
example = "70"; example = 70;
type = types.int; type = types.int;
description = '' description = ''
Set SCT Error Recovery Control timeout in deciseconds for use in RAID configurations. Set SCT Error Recovery Control timeout in deciseconds for use in RAID configurations.

View File

@ -165,11 +165,11 @@ in
hardware.nvidia.package = lib.mkOption { hardware.nvidia.package = lib.mkOption {
type = lib.types.package; type = lib.types.package;
default = config.boot.kernelPackages.nvidiaPackages.stable; default = config.boot.kernelPackages.nvidiaPackages.stable;
defaultText = "config.boot.kernelPackages.nvidiaPackages.stable"; defaultText = literalExpression "config.boot.kernelPackages.nvidiaPackages.stable";
description = '' description = ''
The NVIDIA X11 derivation to use. The NVIDIA X11 derivation to use.
''; '';
example = "config.boot.kernelPackages.nvidiaPackages.legacy_340"; example = literalExpression "config.boot.kernelPackages.nvidiaPackages.legacy_340";
}; };
}; };

View File

@ -33,7 +33,7 @@ in
packages = mkOption { packages = mkOption {
type = types.listOf types.path; type = types.listOf types.path;
example = literalExample "[ pkgs.tiscamera ]"; example = literalExpression "[ pkgs.tiscamera ]";
description = '' description = ''
List of packages containing <command>uvcvideo</command> dynamic controls List of packages containing <command>uvcvideo</command> dynamic controls
rules. All files found in rules. All files found in

View File

@ -17,7 +17,7 @@ in
engines = mkOption { engines = mkOption {
type = with types; listOf fcitxEngine; type = with types; listOf fcitxEngine;
default = []; default = [];
example = literalExample "with pkgs.fcitx-engines; [ mozc hangul ]"; example = literalExpression "with pkgs.fcitx-engines; [ mozc hangul ]";
description = description =
let let
enginesDrv = filterAttrs (const isDerivation) pkgs.fcitx-engines; enginesDrv = filterAttrs (const isDerivation) pkgs.fcitx-engines;

View File

@ -12,7 +12,7 @@ in {
addons = mkOption { addons = mkOption {
type = with types; listOf package; type = with types; listOf package;
default = []; default = [];
example = with pkgs; [ fcitx5-rime ]; example = literalExpression "with pkgs; [ fcitx5-rime ]";
description = '' description = ''
Enabled Fcitx5 addons. Enabled Fcitx5 addons.
''; '';

View File

@ -36,7 +36,7 @@ in
engines = mkOption { engines = mkOption {
type = with types; listOf ibusEngine; type = with types; listOf ibusEngine;
default = []; default = [];
example = literalExample "with pkgs.ibus-engines; [ mozc hangul ]"; example = literalExpression "with pkgs.ibus-engines; [ mozc hangul ]";
description = description =
let let
enginesDrv = filterAttrs (const isDerivation) pkgs.ibus-engines; enginesDrv = filterAttrs (const isDerivation) pkgs.ibus-engines;
@ -48,7 +48,7 @@ in
panel = mkOption { panel = mkOption {
type = with types; nullOr path; type = with types; nullOr path;
default = null; default = null;
example = literalExample "''${pkgs.plasma5Packages.plasma-desktop}/lib/libexec/kimpanel-ibus-panel"; example = literalExpression ''"''${pkgs.plasma5Packages.plasma-desktop}/lib/libexec/kimpanel-ibus-panel"'';
description = "Replace the IBus panel with another panel."; description = "Replace the IBus panel with another panel.";
}; };
}; };

View File

@ -10,7 +10,7 @@ in
config = mkOption { config = mkOption {
type = yamlFormat.type; type = yamlFormat.type;
default = { }; default = { };
example = literalExample '' example = literalExpression ''
{ {
daemon = { daemon = {
modules = ["Xim" "Indicator"]; modules = ["Xim" "Indicator"];

View File

@ -528,7 +528,7 @@ in
}; };
isoImage.contents = mkOption { isoImage.contents = mkOption {
example = literalExample '' example = literalExpression ''
[ { source = pkgs.memtest86 + "/memtest.bin"; [ { source = pkgs.memtest86 + "/memtest.bin";
target = "boot/memtest.bin"; target = "boot/memtest.bin";
} }
@ -541,7 +541,7 @@ in
}; };
isoImage.storeContents = mkOption { isoImage.storeContents = mkOption {
example = literalExample "[ pkgs.stdenv ]"; example = literalExpression "[ pkgs.stdenv ]";
description = '' description = ''
This option lists additional derivations to be included in the This option lists additional derivations to be included in the
Nix store in the generated ISO image. Nix store in the generated ISO image.

View File

@ -15,7 +15,7 @@ in
{ {
options = { options = {
tarball.contents = mkOption { tarball.contents = mkOption {
example = literalExample '' example = literalExpression ''
[ { source = pkgs.memtest86 + "/memtest.bin"; [ { source = pkgs.memtest86 + "/memtest.bin";
target = "boot/memtest.bin"; target = "boot/memtest.bin";
} }
@ -28,7 +28,7 @@ in
}; };
tarball.storeContents = mkOption { tarball.storeContents = mkOption {
example = literalExample "[ pkgs.stdenv ]"; example = literalExpression "[ pkgs.stdenv ]";
description = '' description = ''
This option lists additional derivations to be included in the This option lists additional derivations to be included in the
Nix store in the generated ISO image. Nix store in the generated ISO image.

View File

@ -9,7 +9,7 @@ with lib;
options = { options = {
netboot.storeContents = mkOption { netboot.storeContents = mkOption {
example = literalExample "[ pkgs.stdenv ]"; example = literalExpression "[ pkgs.stdenv ]";
description = '' description = ''
This option lists additional derivations to be included in the This option lists additional derivations to be included in the
Nix store in the generated netboot image. Nix store in the generated netboot image.

View File

@ -49,7 +49,7 @@ in
storePaths = mkOption { storePaths = mkOption {
type = with types; listOf package; type = with types; listOf package;
example = literalExample "[ pkgs.stdenv ]"; example = literalExpression "[ pkgs.stdenv ]";
description = '' description = ''
Derivations to be included in the Nix store in the generated SD image. Derivations to be included in the Nix store in the generated SD image.
''; '';
@ -107,7 +107,7 @@ in
}; };
populateFirmwareCommands = mkOption { populateFirmwareCommands = mkOption {
example = literalExample "'' cp \${pkgs.myBootLoader}/u-boot.bin firmware/ ''"; example = literalExpression "'' cp \${pkgs.myBootLoader}/u-boot.bin firmware/ ''";
description = '' description = ''
Shell commands to populate the ./firmware directory. Shell commands to populate the ./firmware directory.
All files in that directory are copied to the All files in that directory are copied to the
@ -116,7 +116,7 @@ in
}; };
populateRootCommands = mkOption { populateRootCommands = mkOption {
example = literalExample "''\${config.boot.loader.generic-extlinux-compatible.populateCmd} -c \${config.system.build.toplevel} -d ./files/boot''"; example = literalExpression "''\${config.boot.loader.generic-extlinux-compatible.populateCmd} -c \${config.system.build.toplevel} -d ./files/boot''";
description = '' description = ''
Shell commands to populate the ./files directory. Shell commands to populate the ./files directory.
All files in that directory are copied to the All files in that directory are copied to the
@ -126,7 +126,7 @@ in
}; };
postBuildCommands = mkOption { postBuildCommands = mkOption {
example = literalExample "'' dd if=\${pkgs.myBootLoader}/SPL of=$img bs=1024 seek=1 conv=notrunc ''"; example = literalExpression "'' dd if=\${pkgs.myBootLoader}/SPL of=$img bs=1024 seek=1 conv=notrunc ''";
default = ""; default = "";
description = '' description = ''
Shell commands to run after the image is built. Shell commands to run after the image is built.

View File

@ -133,7 +133,7 @@ in
extraOutputsToInstall = ["man"]; extraOutputsToInstall = ["man"];
ignoreCollisions = true; ignoreCollisions = true;
}; };
defaultText = "all man pages in config.environment.systemPackages"; defaultText = literalDocBook "all man pages in <option>config.environment.systemPackages</option>";
description = '' description = ''
The manual pages to generate caches for if <option>generateCaches</option> The manual pages to generate caches for if <option>generateCaches</option>
is enabled. Must be a path to a directory with man pages under is enabled. Must be a path to a directory with man pages under
@ -211,7 +211,7 @@ in
Which extra NixOS module paths the generated NixOS's documentation should strip Which extra NixOS module paths the generated NixOS's documentation should strip
from options. from options.
''; '';
example = literalExample '' example = literalExpression ''
# e.g. with options from modules in ''${pkgs.customModules}/nix: # e.g. with options from modules in ''${pkgs.customModules}/nix:
[ pkgs.customModules ] [ pkgs.customModules ]
''; '';

View File

@ -25,8 +25,8 @@ in {
locate = mkOption { locate = mkOption {
type = package; type = package;
default = pkgs.findutils; default = pkgs.findutils;
defaultText = "pkgs.findutils"; defaultText = literalExpression "pkgs.findutils";
example = "pkgs.mlocate"; example = literalExpression "pkgs.mlocate";
description = '' description = ''
The locate implementation to use The locate implementation to use
''; '';

View File

@ -67,13 +67,13 @@ in
options.nixpkgs = { options.nixpkgs = {
pkgs = mkOption { pkgs = mkOption {
defaultText = literalExample defaultText = literalExpression ''
''import "''${nixos}/.." { import "''${nixos}/.." {
inherit (cfg) config overlays localSystem crossSystem; inherit (cfg) config overlays localSystem crossSystem;
} }
''; '';
type = pkgsType; type = pkgsType;
example = literalExample "import <nixpkgs> {}"; example = literalExpression "import <nixpkgs> {}";
description = '' description = ''
If set, the pkgs argument to all NixOS modules is the value of If set, the pkgs argument to all NixOS modules is the value of
this option, extended with <code>nixpkgs.overlays</code>, if this option, extended with <code>nixpkgs.overlays</code>, if
@ -109,7 +109,7 @@ in
config = mkOption { config = mkOption {
default = {}; default = {};
example = literalExample example = literalExpression
'' ''
{ allowBroken = true; allowUnfree = true; } { allowBroken = true; allowUnfree = true; }
''; '';
@ -125,7 +125,7 @@ in
overlays = mkOption { overlays = mkOption {
default = []; default = [];
example = literalExample example = literalExpression
'' ''
[ [
(self: super: { (self: super: {
@ -158,7 +158,7 @@ in
# Make sure that the final value has all fields for sake of other modules # Make sure that the final value has all fields for sake of other modules
# referring to this. TODO make `lib.systems` itself use the module system. # referring to this. TODO make `lib.systems` itself use the module system.
apply = lib.systems.elaborate; apply = lib.systems.elaborate;
defaultText = literalExample defaultText = literalExpression
''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform''; ''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
description = '' description = ''
Specifies the platform on which NixOS should be built. When Specifies the platform on which NixOS should be built. When

View File

@ -19,7 +19,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.atop; default = pkgs.atop;
defaultText = "pkgs.atop"; defaultText = literalExpression "pkgs.atop";
description = '' description = ''
Which package to use for Atop. Which package to use for Atop.
''; '';
@ -37,7 +37,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = config.boot.kernelPackages.netatop; default = config.boot.kernelPackages.netatop;
defaultText = "config.boot.kernelPackages.netatop"; defaultText = literalExpression "config.boot.kernelPackages.netatop";
description = '' description = ''
Which package to use for netatop. Which package to use for netatop.
''; '';

View File

@ -14,7 +14,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.captive-browser; default = pkgs.captive-browser;
defaultText = "pkgs.captive-browser"; defaultText = literalExpression "pkgs.captive-browser";
description = "Which package to use for captive-browser"; description = "Which package to use for captive-browser";
}; };

View File

@ -33,7 +33,7 @@ in
for additional details. for additional details.
''; '';
default = []; default = [];
example = literalExample '' example = literalExpression ''
[ [
"chlffgpmiacpedhhbkiomidkjlcfhogd" # pushbullet "chlffgpmiacpedhhbkiomidkjlcfhogd" # pushbullet
"mbniclmhobmnbdlbpiphghaielnnpgdp" # lightshot "mbniclmhobmnbdlbpiphghaielnnpgdp" # lightshot
@ -75,7 +75,7 @@ in
Make sure the selected policy is supported on Linux and your browser version. Make sure the selected policy is supported on Linux and your browser version.
''; '';
default = {}; default = {};
example = literalExample '' example = literalExpression ''
{ {
"BrowserSignin" = 0; "BrowserSignin" = 0;
"SyncDisabled" = true; "SyncDisabled" = true;

View File

@ -19,7 +19,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.digitalbitbox; default = pkgs.digitalbitbox;
defaultText = "pkgs.digitalbitbox"; defaultText = literalExpression "pkgs.digitalbitbox";
description = "The Digital Bitbox package to use. This can be used to install a package with udev rules that differ from the defaults."; description = "The Digital Bitbox package to use. This can be used to install a package with udev rules that differ from the defaults.";
}; };
}; };

View File

@ -24,7 +24,7 @@ in {
package = mkOption { package = mkOption {
default = pkgs.dmrconfig; default = pkgs.dmrconfig;
type = types.package; type = types.package;
defaultText = "pkgs.dmrconfig"; defaultText = literalExpression "pkgs.dmrconfig";
description = "dmrconfig derivation to use"; description = "dmrconfig derivation to use";
}; };
}; };

View File

@ -18,6 +18,7 @@ in {
''; '';
type = types.package; type = types.package;
default = pkgs.feedbackd; default = pkgs.feedbackd;
defaultText = literalExpression "pkgs.feedbackd";
}; };
}; };
}; };

View File

@ -40,13 +40,13 @@ in {
executable = mkOption { executable = mkOption {
type = types.path; type = types.path;
description = "Executable to run sandboxed"; description = "Executable to run sandboxed";
example = literalExample "''${lib.getBin pkgs.firefox}/bin/firefox"; example = literalExpression ''"''${lib.getBin pkgs.firefox}/bin/firefox"'';
}; };
profile = mkOption { profile = mkOption {
type = types.nullOr types.path; type = types.nullOr types.path;
default = null; default = null;
description = "Profile to use"; description = "Profile to use";
example = literalExample "''${pkgs.firejail}/etc/firejail/firefox.profile"; example = literalExpression ''"''${pkgs.firejail}/etc/firejail/firefox.profile"'';
}; };
extraArgs = mkOption { extraArgs = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
@ -57,7 +57,7 @@ in {
}; };
})); }));
default = {}; default = {};
example = literalExample '' example = literalExpression ''
{ {
firefox = { firefox = {
executable = "''${lib.getBin pkgs.firefox}/bin/firefox"; executable = "''${lib.getBin pkgs.firefox}/bin/firefox";

View File

@ -13,7 +13,7 @@ in {
description = "FLEXOPTIX app package to use"; description = "FLEXOPTIX app package to use";
type = types.package; type = types.package;
default = pkgs.flexoptix-app; default = pkgs.flexoptix-app;
defaultText = "\${pkgs.flexoptix-app}"; defaultText = literalExpression "pkgs.flexoptix-app";
}; };
}; };
}; };

View File

@ -17,7 +17,7 @@ in
environment.freetds = mkOption { environment.freetds = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = {}; default = {};
example = literalExample '' example = literalExpression ''
{ MYDATABASE = ''' { MYDATABASE = '''
host = 10.0.2.100 host = 10.0.2.100
port = 1433 port = 1433

View File

@ -23,7 +23,7 @@ in
System-wide configuration for GameMode (/etc/gamemode.ini). System-wide configuration for GameMode (/etc/gamemode.ini).
See gamemoded(8) man page for available settings. See gamemoded(8) man page for available settings.
''; '';
example = literalExample '' example = literalExpression ''
{ {
general = { general = {
renice = 10; renice = 10;

View File

@ -14,8 +14,8 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.git; default = pkgs.git;
defaultText = "pkgs.git"; defaultText = literalExpression "pkgs.git";
example = literalExample "pkgs.gitFull"; example = literalExpression "pkgs.gitFull";
description = "The git package to use"; description = "The git package to use";
}; };

View File

@ -27,7 +27,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.gnupg; default = pkgs.gnupg;
defaultText = "pkgs.gnupg"; defaultText = literalExpression "pkgs.gnupg";
description = '' description = ''
The gpg package that should be used. The gpg package that should be used.
''; '';

View File

@ -34,7 +34,7 @@ in
package = mkOption { package = mkOption {
default = pkgs.jdk; default = pkgs.jdk;
defaultText = "pkgs.jdk"; defaultText = literalExpression "pkgs.jdk";
description = '' description = ''
Java package to install. Typical values are pkgs.jdk or pkgs.jre. Java package to install. Typical values are pkgs.jdk or pkgs.jre.
''; '';

View File

@ -13,9 +13,9 @@ with lib;
''; '';
package = mkOption { package = mkOption {
default = pkgs.kdeconnect; default = pkgs.kdeconnect;
defaultText = "pkgs.kdeconnect"; defaultText = literalExpression "pkgs.kdeconnect";
type = types.package; type = types.package;
example = literalExample "pkgs.gnomeExtensions.gsconnect"; example = literalExpression "pkgs.gnomeExtensions.gsconnect";
description = '' description = ''
The package providing the implementation for kdeconnect. The package providing the implementation for kdeconnect.
''; '';

View File

@ -40,7 +40,7 @@ in
configFile = mkOption { configFile = mkOption {
type = types.nullOr types.path; type = types.nullOr types.path;
default = null; default = null;
example = literalExample "\${pkgs.my-configs}/lesskey"; example = literalExpression ''"''${pkgs.my-configs}/lesskey"'';
description = '' description = ''
Path to lesskey configuration file. Path to lesskey configuration file.
@ -91,6 +91,7 @@ in
lessopen = mkOption { lessopen = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = "|${pkgs.lesspipe}/bin/lesspipe.sh %s"; default = "|${pkgs.lesspipe}/bin/lesspipe.sh %s";
defaultText = literalExpression ''"|''${pkgs.lesspipe}/bin/lesspipe.sh %s"'';
description = '' description = ''
Before less opens a file, it first gives your input preprocessor a chance to modify the way the contents of the file are displayed. Before less opens a file, it first gives your input preprocessor a chance to modify the way the contents of the file are displayed.
''; '';

View File

@ -20,6 +20,7 @@ in {
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.mtr; default = pkgs.mtr;
defaultText = literalExpression "pkgs.mtr";
description = '' description = ''
The package to use. The package to use.
''; '';

View File

@ -47,18 +47,18 @@ in {
configure = mkOption { configure = mkOption {
type = types.attrs; type = types.attrs;
default = {}; default = {};
example = literalExample '' example = literalExpression ''
configure = { {
customRC = $'''' customRC = '''
" here your custom configuration goes! " here your custom configuration goes!
$''''; ''';
packages.myVimPackage = with pkgs.vimPlugins; { packages.myVimPackage = with pkgs.vimPlugins; {
# loaded on launch # loaded on launch
start = [ fugitive ]; start = [ fugitive ];
# manually loadable by calling `:packadd $plugin-name` # manually loadable by calling `:packadd $plugin-name`
opt = [ ]; opt = [ ];
};
}; };
}
''; '';
description = '' description = ''
Generate your init file from your list of plugins and custom commands. Generate your init file from your list of plugins and custom commands.
@ -69,7 +69,7 @@ in {
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.neovim-unwrapped; default = pkgs.neovim-unwrapped;
defaultText = literalExample "pkgs.neovim-unwrapped"; defaultText = literalExpression "pkgs.neovim-unwrapped";
description = "The package to use for the neovim binary."; description = "The package to use for the neovim binary.";
}; };
@ -82,8 +82,8 @@ in {
runtime = mkOption { runtime = mkOption {
default = {}; default = {};
example = literalExample '' example = literalExpression ''
runtime."ftplugin/c.vim".text = "setlocal omnifunc=v:lua.vim.lsp.omnifunc"; { "ftplugin/c.vim".text = "setlocal omnifunc=v:lua.vim.lsp.omnifunc"; }
''; '';
description = '' description = ''
Set of files that have to be linked in <filename>runtime</filename>. Set of files that have to be linked in <filename>runtime</filename>.

View File

@ -10,6 +10,7 @@ in {
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.noisetorch; default = pkgs.noisetorch;
defaultText = literalExpression "pkgs.noisetorch";
description = '' description = ''
The noisetorch package to use. The noisetorch package to use.
''; '';

View File

@ -14,10 +14,11 @@ in
enable = mkEnableOption "<command>npm</command> global config"; enable = mkEnableOption "<command>npm</command> global config";
package = mkOption { package = mkOption {
type = types.path; type = types.package;
description = "The npm package version / flavor to use"; description = "The npm package version / flavor to use";
default = pkgs.nodePackages.npm; default = pkgs.nodePackages.npm;
example = literalExample "pkgs.nodePackages_13_x.npm"; defaultText = literalExpression "pkgs.nodePackages.npm";
example = literalExpression "pkgs.nodePackages_13_x.npm";
}; };
npmrc = mkOption { npmrc = mkOption {

View File

@ -120,7 +120,7 @@ in {
Proxies to be used by proxychains. Proxies to be used by proxychains.
''; '';
example = literalExample '' example = literalExpression ''
{ myproxy = { myproxy =
{ type = "socks4"; { type = "socks4";
host = "127.0.0.1"; host = "127.0.0.1";

View File

@ -66,7 +66,7 @@ in
This must not be a store path, since the path is This must not be a store path, since the path is
used outside the store (in particular in /etc/passwd). used outside the store (in particular in /etc/passwd).
''; '';
example = literalExample "pkgs.zsh"; example = literalExpression "pkgs.zsh";
type = types.either types.path types.shellPackage; type = types.either types.path types.shellPackage;
}; };

View File

@ -29,11 +29,13 @@ in
terminal_su = "${pkgs.sudo}/bin/sudo"; terminal_su = "${pkgs.sudo}/bin/sudo";
graphical_su = "${pkgs.gksu}/bin/gksu"; graphical_su = "${pkgs.gksu}/bin/gksu";
}; };
example = literalExample ''{ defaultText = literalExpression ''
tmp_dir = "/tmp"; {
terminal_su = "''${pkgs.sudo}/bin/sudo"; tmp_dir = "/tmp";
graphical_su = "''${pkgs.gksu}/bin/gksu"; terminal_su = "''${pkgs.sudo}/bin/sudo";
}''; graphical_su = "''${pkgs.gksu}/bin/gksu";
}
'';
description = '' description = ''
The system-wide spacefm configuration. The system-wide spacefm configuration.
Parameters to be written to <filename>/etc/spacefm/spacefm.conf</filename>. Parameters to be written to <filename>/etc/spacefm/spacefm.conf</filename>.

View File

@ -36,6 +36,7 @@ in
askPassword = mkOption { askPassword = mkOption {
type = types.str; type = types.str;
default = "${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass"; default = "${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass";
defaultText = literalExpression ''"''${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass"'';
description = "Program used by SSH to ask for passwords."; description = "Program used by SSH to ask for passwords.";
}; };
@ -113,7 +114,7 @@ in
agentPKCS11Whitelist = mkOption { agentPKCS11Whitelist = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
example = "\${pkgs.opensc}/lib/opensc-pkcs11.so"; example = literalExpression ''"''${pkgs.opensc}/lib/opensc-pkcs11.so"'';
description = '' description = ''
A pattern-list of acceptable paths for PKCS#11 shared libraries A pattern-list of acceptable paths for PKCS#11 shared libraries
that may be used with the -s option to ssh-add. that may be used with the -s option to ssh-add.
@ -123,7 +124,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.openssh; default = pkgs.openssh;
defaultText = "pkgs.openssh"; defaultText = literalExpression "pkgs.openssh";
description = '' description = ''
The package used for the openssh client and daemon. The package used for the openssh client and daemon.
''; '';
@ -180,7 +181,7 @@ in
description = '' description = ''
The set of system-wide known SSH hosts. The set of system-wide known SSH hosts.
''; '';
example = literalExample '' example = literalExpression ''
{ {
myhost = { myhost = {
hostNames = [ "myhost" "myhost.mydomain.com" "10.10.1.4" ]; hostNames = [ "myhost" "myhost.mydomain.com" "10.10.1.4" ];

View File

@ -54,7 +54,7 @@ in
<citerefentry><refentrytitle>ssmtp</refentrytitle><manvolnum>5</manvolnum></citerefentry> configuration. Refer <citerefentry><refentrytitle>ssmtp</refentrytitle><manvolnum>5</manvolnum></citerefentry> configuration. Refer
to <link xlink:href="https://linux.die.net/man/5/ssmtp.conf"/> for details on supported values. to <link xlink:href="https://linux.die.net/man/5/ssmtp.conf"/> for details on supported values.
''; '';
example = literalExample '' example = literalExpression ''
{ {
Debug = true; Debug = true;
FromLineOverride = false; FromLineOverride = false;

View File

@ -92,10 +92,10 @@ in {
default = with pkgs; [ default = with pkgs; [
swaylock swayidle alacritty dmenu swaylock swayidle alacritty dmenu
]; ];
defaultText = literalExample '' defaultText = literalExpression ''
with pkgs; [ swaylock swayidle alacritty dmenu ]; with pkgs; [ swaylock swayidle alacritty dmenu ];
''; '';
example = literalExample '' example = literalExpression ''
with pkgs; [ with pkgs; [
i3status i3status-rust i3status i3status-rust
termite rofi light termite rofi light

View File

@ -5,7 +5,7 @@ let
inherit (builtins) length map; inherit (builtins) length map;
inherit (lib.attrsets) attrNames filterAttrs hasAttr mapAttrs mapAttrsToList optionalAttrs; inherit (lib.attrsets) attrNames filterAttrs hasAttr mapAttrs mapAttrsToList optionalAttrs;
inherit (lib.modules) mkDefault mkIf; inherit (lib.modules) mkDefault mkIf;
inherit (lib.options) literalExample mkEnableOption mkOption; inherit (lib.options) literalExpression mkEnableOption mkOption;
inherit (lib.strings) concatStringsSep optionalString toLower; inherit (lib.strings) concatStringsSep optionalString toLower;
inherit (lib.types) addCheck attrsOf lines nullOr package path port str strMatching submodule; inherit (lib.types) addCheck attrsOf lines nullOr package path port str strMatching submodule;
@ -123,7 +123,7 @@ let
}; };
options.text = mkOption { options.text = mkOption {
type = lines; type = lines;
example = literalExample example = literalExpression
''lib.modules.mkAfter "compression no"''; ''lib.modules.mkAfter "compression no"'';
description = '' description = ''
Additional text lines for the server stanza. Additional text lines for the server stanza.
@ -218,8 +218,8 @@ let
package = mkOption { package = mkOption {
type = package; type = package;
default = pkgs.tsm-client; default = pkgs.tsm-client;
defaultText = "pkgs.tsm-client"; defaultText = literalExpression "pkgs.tsm-client";
example = literalExample "pkgs.tsm-client-withGui"; example = literalExpression "pkgs.tsm-client-withGui";
description = '' description = ''
The TSM client derivation to be The TSM client derivation to be
added to the system environment. added to the system environment.

View File

@ -18,8 +18,8 @@ in {
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.vim; default = pkgs.vim;
defaultText = "pkgs.vim"; defaultText = literalExpression "pkgs.vim";
example = "pkgs.vimHugeX"; example = literalExpression "pkgs.vimHugeX";
description = '' description = ''
vim package to use. vim package to use.
''; '';

View File

@ -19,7 +19,7 @@ in {
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.wireshark-cli; default = pkgs.wireshark-cli;
defaultText = "pkgs.wireshark-cli"; defaultText = literalExpression "pkgs.wireshark-cli";
description = '' description = ''
Which Wireshark package to install in the global environment. Which Wireshark package to install in the global environment.
''; '';

View File

@ -27,7 +27,8 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.xonsh; default = pkgs.xonsh;
example = literalExample "pkgs.xonsh.override { configFile = \"/path/to/xonshrc\"; }"; defaultText = literalExpression "pkgs.xonsh";
example = literalExpression "pkgs.xonsh.override { configFile = \"/path/to/xonshrc\"; }";
description = '' description = ''
xonsh package to use. xonsh package to use.
''; '';

View File

@ -11,7 +11,8 @@ in
lockerCommand = mkOption { lockerCommand = mkOption {
default = "${pkgs.i3lock}/bin/i3lock"; default = "${pkgs.i3lock}/bin/i3lock";
example = literalExample "\${pkgs.i3lock-fancy}/bin/i3lock-fancy"; defaultText = literalExpression ''"''${pkgs.i3lock}/bin/i3lock"'';
example = literalExpression ''"''${pkgs.i3lock-fancy}/bin/i3lock-fancy"'';
type = types.separatedString " "; type = types.separatedString " ";
description = "Locker to be used with xsslock"; description = "Locker to be used with xsslock";
}; };

View File

@ -16,9 +16,8 @@ in
type = types.str; type = types.str;
default = optionalString config.fonts.fontDir.enable default = optionalString config.fonts.fontDir.enable
"/run/current-system/sw/share/X11/fonts"; "/run/current-system/sw/share/X11/fonts";
defaultText = literalExample '' defaultText = literalExpression ''
optionalString config.fonts.fontDir.enable optionalString config.fonts.fontDir.enable "/run/current-system/sw/share/X11/fonts"
"/run/current-system/sw/share/X11/fonts";
''; '';
description = '' description = ''
Default font path. Setting this option causes Xwayland to be rebuilt. Default font path. Setting this option causes Xwayland to be rebuilt.
@ -30,10 +29,10 @@ in
default = pkgs.xwayland.override (oldArgs: { default = pkgs.xwayland.override (oldArgs: {
inherit (cfg) defaultFontPath; inherit (cfg) defaultFontPath;
}); });
defaultText = literalExample '' defaultText = literalExpression ''
pkgs.xwayland.override (oldArgs: { pkgs.xwayland.override (oldArgs: {
inherit (config.programs.xwayland) defaultFontPath; inherit (config.programs.xwayland) defaultFontPath;
}); })
''; '';
description = "The Xwayland package to use."; description = "The Xwayland package to use.";
}; };

View File

@ -45,7 +45,8 @@ in
package = mkOption { package = mkOption {
default = pkgs.yabar-unstable; default = pkgs.yabar-unstable;
example = literalExample "pkgs.yabar"; defaultText = literalExpression "pkgs.yabar-unstable";
example = literalExpression "pkgs.yabar";
type = types.package; type = types.package;
# `yabar-stable` segfaults under certain conditions. # `yabar-stable` segfaults under certain conditions.

View File

@ -48,7 +48,7 @@ in
package = mkOption { package = mkOption {
default = pkgs.oh-my-zsh; default = pkgs.oh-my-zsh;
defaultText = "pkgs.oh-my-zsh"; defaultText = literalExpression "pkgs.oh-my-zsh";
description = '' description = ''
Package to install for `oh-my-zsh` usage. Package to install for `oh-my-zsh` usage.
''; '';

View File

@ -10,7 +10,7 @@ in {
enable = mkEnableOption "zsh-autoenv"; enable = mkEnableOption "zsh-autoenv";
package = mkOption { package = mkOption {
default = pkgs.zsh-autoenv; default = pkgs.zsh-autoenv;
defaultText = "pkgs.zsh-autoenv"; defaultText = literalExpression "pkgs.zsh-autoenv";
description = '' description = ''
Package to install for `zsh-autoenv` usage. Package to install for `zsh-autoenv` usage.
''; '';

View File

@ -40,7 +40,7 @@ in
type = with types; attrsOf str; type = with types; attrsOf str;
default = {}; default = {};
description = "Attribute set with additional configuration values"; description = "Attribute set with additional configuration values";
example = literalExample '' example = literalExpression ''
{ {
"ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" = "20"; "ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" = "20";
} }

View File

@ -42,7 +42,7 @@ in
default = {}; default = {};
type = types.attrsOf types.str; type = types.attrsOf types.str;
example = literalExample '' example = literalExpression ''
{ {
"rm -rf *" = "fg=white,bold,bg=red"; "rm -rf *" = "fg=white,bold,bg=red";
} }
@ -59,7 +59,7 @@ in
default = {}; default = {};
type = types.attrsOf types.str; type = types.attrsOf types.str;
example = literalExample '' example = literalExpression ''
{ {
"alias" = "fg=magenta,bold"; "alias" = "fg=magenta,bold";
} }

View File

@ -486,7 +486,7 @@ let
extraDomainNames = mkOption { extraDomainNames = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
example = literalExample '' example = literalExpression ''
[ [
"example.org" "example.org"
"mydomain.org" "mydomain.org"
@ -656,7 +656,7 @@ in {
to those units if they rely on the certificates being present, to those units if they rely on the certificates being present,
or trigger restarts of the service if certificates get renewed. or trigger restarts of the service if certificates get renewed.
''; '';
example = literalExample '' example = literalExpression ''
{ {
"example.com" = { "example.com" = {
webroot = "/var/lib/acme/acme-challenge/"; webroot = "/var/lib/acme/acme-challenge/";

View File

@ -24,7 +24,7 @@ in
security.pki.certificateFiles = mkOption { security.pki.certificateFiles = mkOption {
type = types.listOf types.path; type = types.listOf types.path;
default = []; default = [];
example = literalExample "[ \"\${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt\" ]"; example = literalExpression ''[ "''${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ]'';
description = '' description = ''
A list of files containing trusted root certificates in PEM A list of files containing trusted root certificates in PEM
format. These are concatenated to form format. These are concatenated to form
@ -37,7 +37,7 @@ in
security.pki.certificates = mkOption { security.pki.certificates = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
example = literalExample '' example = literalExpression ''
[ ''' [ '''
NixOS.org NixOS.org
========= =========

View File

@ -53,7 +53,7 @@ in {
coerce = bits: { inherit bits; }; coerce = bits: { inherit bits; };
in attrsOf (coercedTo int coerce (submodule paramsSubmodule)); in attrsOf (coercedTo int coerce (submodule paramsSubmodule));
default = {}; default = {};
example = lib.literalExample "{ nginx.bits = 3072; }"; example = lib.literalExpression "{ nginx.bits = 3072; }";
description = '' description = ''
Diffie-Hellman parameters to generate. Diffie-Hellman parameters to generate.

View File

@ -77,7 +77,7 @@ in
You can use <code>mkBefore</code> and/or <code>mkAfter</code> to ensure You can use <code>mkBefore</code> and/or <code>mkAfter</code> to ensure
this is the case when configuration options are merged. this is the case when configuration options are merged.
''; '';
example = literalExample '' example = literalExpression ''
[ [
# Allow execution of any command by any user in group doas, requiring # Allow execution of any command by any user in group doas, requiring
# a password and keeping any previously-defined environment variables. # a password and keeping any previously-defined environment variables.

View File

@ -586,7 +586,7 @@ in
}; };
security.pam.services = mkOption { security.pam.services = mkOption {
default = []; default = {};
type = with types; attrsOf (submodule pamOpts); type = with types; attrsOf (submodule pamOpts);
description = description =
'' ''

View File

@ -33,7 +33,7 @@ in
additionalSearchPaths = mkOption { additionalSearchPaths = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = []; default = [];
example = literalExample "[ pkgs.bindfs ]"; example = literalExpression "[ pkgs.bindfs ]";
description = '' description = ''
Additional programs to include in the search path of pam_mount. Additional programs to include in the search path of pam_mount.
Useful for example if you want to use some FUSE filesystems like bindfs. Useful for example if you want to use some FUSE filesystems like bindfs.
@ -43,7 +43,7 @@ in
fuseMountOptions = mkOption { fuseMountOptions = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
example = literalExample '' example = literalExpression ''
[ "nodev" "nosuid" "force-user=%(USER)" "gid=%(USERGID)" "perms=0700" "chmod-deny" "chown-deny" "chgrp-deny" ] [ "nodev" "nosuid" "force-user=%(USER)" "gid=%(USERGID)" "perms=0700" "chmod-deny" "chown-deny" "chgrp-deny" ]
''; '';
description = '' description = ''

View File

@ -45,7 +45,7 @@ in
security.sudo.package = mkOption { security.sudo.package = mkOption {
type = types.package; type = types.package;
default = pkgs.sudo; default = pkgs.sudo;
defaultText = "pkgs.sudo"; defaultText = literalExpression "pkgs.sudo";
description = '' description = ''
Which package to use for `sudo`. Which package to use for `sudo`.
''; '';
@ -91,7 +91,7 @@ in
this is the case when configuration options are merged. this is the case when configuration options are merged.
''; '';
default = []; default = [];
example = literalExample '' example = literalExpression ''
[ [
# Allow execution of any command by all users in group sudo, # Allow execution of any command by all users in group sudo,
# requiring a password. # requiring a password.

View File

@ -62,8 +62,8 @@ in {
options.confinement.binSh = lib.mkOption { options.confinement.binSh = lib.mkOption {
type = types.nullOr types.path; type = types.nullOr types.path;
default = toplevelConfig.environment.binsh; default = toplevelConfig.environment.binsh;
defaultText = "config.environment.binsh"; defaultText = lib.literalExpression "config.environment.binsh";
example = lib.literalExample "\${pkgs.dash}/bin/dash"; example = lib.literalExpression ''"''${pkgs.dash}/bin/dash"'';
description = '' description = ''
The program to make available as <filename>/bin/sh</filename> inside The program to make available as <filename>/bin/sh</filename> inside
the chroot. If this is set to <literal>null</literal>, no the chroot. If this is set to <literal>null</literal>, no

View File

@ -26,8 +26,7 @@ in {
''; '';
type = lib.types.nullOr lib.types.str; type = lib.types.nullOr lib.types.str;
default = if cfg.abrmd.enable then "tss" else "root"; default = if cfg.abrmd.enable then "tss" else "root";
defaultText = ''"tss" when using the userspace resource manager,'' + defaultText = lib.literalExpression ''if config.security.tpm2.abrmd.enable then "tss" else "root"'';
''"root" otherwise'';
}; };
tssGroup = lib.mkOption { tssGroup = lib.mkOption {
@ -57,7 +56,7 @@ in {
description = "tpm2-abrmd package to use"; description = "tpm2-abrmd package to use";
type = lib.types.package; type = lib.types.package;
default = pkgs.tpm2-abrmd; default = pkgs.tpm2-abrmd;
defaultText = "pkgs.tpm2-abrmd"; defaultText = lib.literalExpression "pkgs.tpm2-abrmd";
}; };
}; };
@ -71,7 +70,7 @@ in {
description = "tpm2-pkcs11 package to use"; description = "tpm2-pkcs11 package to use";
type = lib.types.package; type = lib.types.package;
default = pkgs.tpm2-pkcs11; default = pkgs.tpm2-pkcs11;
defaultText = "pkgs.tpm2-pkcs11"; defaultText = lib.literalExpression "pkgs.tpm2-pkcs11";
}; };
}; };

View File

@ -152,7 +152,7 @@ in
security.wrappers = lib.mkOption { security.wrappers = lib.mkOption {
type = lib.types.attrsOf wrapperType; type = lib.types.attrsOf wrapperType;
default = {}; default = {};
example = lib.literalExample example = lib.literalExpression
'' ''
{ {
# a setuid root program # a setuid root program

View File

@ -10,7 +10,7 @@ in with lib; {
description = "MeshCentral package to use. Replacing this may be necessary to add dependencies for extra functionality."; description = "MeshCentral package to use. Replacing this may be necessary to add dependencies for extra functionality.";
type = types.package; type = types.package;
default = pkgs.meshcentral; default = pkgs.meshcentral;
defaultText = "pkgs.meshcentral"; defaultText = literalExpression "pkgs.meshcentral";
}; };
settings = mkOption { settings = mkOption {
description = '' description = ''

View File

@ -33,7 +33,7 @@ in
configFile = mkOption { configFile = mkOption {
type = types.path; type = types.path;
example = literalExample '' example = literalExpression ''
pkgs.writeText "oxidized-config.yml" ''' pkgs.writeText "oxidized-config.yml" '''
--- ---
debug: true debug: true
@ -69,7 +69,7 @@ in
routerDB = mkOption { routerDB = mkOption {
type = types.path; type = types.path;
example = literalExample '' example = literalExpression ''
pkgs.writeText "oxidized-router.db" ''' pkgs.writeText "oxidized-router.db" '''
hostname-sw1:powerconnect:username1:password2 hostname-sw1:powerconnect:username1:password2
hostname-sw2:procurve:username2:password2 hostname-sw2:procurve:username2:password2

View File

@ -33,6 +33,7 @@ in {
}; };
configurationDir = mkOption { configurationDir = mkOption {
default = "${activemq}/conf"; default = "${activemq}/conf";
defaultText = literalExpression ''"''${pkgs.activemq}/conf"'';
type = types.str; type = types.str;
description = '' description = ''
The base directory for ActiveMQ's configuration. The base directory for ActiveMQ's configuration.
@ -64,7 +65,7 @@ in {
javaProperties = mkOption { javaProperties = mkOption {
type = types.attrs; type = types.attrs;
default = { }; default = { };
example = literalExample '' example = literalExpression ''
{ {
"java.net.preferIPv4Stack" = "true"; "java.net.preferIPv4Stack" = "true";
} }

View File

@ -29,7 +29,7 @@ in
package = mkOption { package = mkOption {
default = pkgs.rabbitmq-server; default = pkgs.rabbitmq-server;
type = types.package; type = types.package;
defaultText = "pkgs.rabbitmq-server"; defaultText = literalExpression "pkgs.rabbitmq-server";
description = '' description = ''
Which rabbitmq package to use. Which rabbitmq package to use.
''; '';
@ -82,7 +82,7 @@ in
configItems = mkOption { configItems = mkOption {
default = { }; default = { };
type = types.attrsOf types.str; type = types.attrsOf types.str;
example = literalExample '' example = literalExpression ''
{ {
"auth_backends.1.authn" = "rabbit_auth_backend_ldap"; "auth_backends.1.authn" = "rabbit_auth_backend_ldap";
"auth_backends.1.authz" = "rabbit_auth_backend_internal"; "auth_backends.1.authz" = "rabbit_auth_backend_internal";

View File

@ -17,6 +17,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.botamusique; default = pkgs.botamusique;
defaultText = literalExpression "pkgs.botamusique";
description = "The botamusique package to use."; description = "The botamusique package to use.";
}; };

View File

@ -25,8 +25,8 @@ in {
internal = true; internal = true;
type = types.package; type = types.package;
default = pkgs.jack2; default = pkgs.jack2;
defaultText = "pkgs.jack2"; defaultText = literalExpression "pkgs.jack2";
example = literalExample "pkgs.jack1"; example = literalExpression "pkgs.jack1";
description = '' description = ''
The JACK package to use. The JACK package to use.
''; '';
@ -37,7 +37,7 @@ in {
default = [ default = [
"-dalsa" "-dalsa"
]; ];
example = literalExample '' example = literalExpression ''
[ "-dalsa" "--device" "hw:1" ]; [ "-dalsa" "--device" "hw:1" ];
''; '';
description = '' description = ''

View File

@ -39,9 +39,9 @@ in
default = {}; default = {};
example = { example = {
myStream1 = literalExample "\"/etc/liquidsoap/myStream1.liq\""; myStream1 = "/etc/liquidsoap/myStream1.liq";
myStream2 = literalExample "./myStream2.liq"; myStream2 = literalExpression "./myStream2.liq";
myStream3 = literalExample "\"out(playlist(\\\"/srv/music/\\\"))\""; myStream3 = "out(playlist(\"/srv/music/\"))";
}; };
type = types.attrsOf (types.either types.path types.str); type = types.attrsOf (types.either types.path types.str);

View File

@ -39,7 +39,7 @@ in {
extensionPackages = mkOption { extensionPackages = mkOption {
default = []; default = [];
type = types.listOf types.package; type = types.listOf types.package;
example = literalExample "[ pkgs.mopidy-spotify ]"; example = literalExpression "[ pkgs.mopidy-spotify ]";
description = '' description = ''
Mopidy extensions that should be loaded by the service. Mopidy extensions that should be loaded by the service.
''; '';

View File

@ -74,7 +74,7 @@ in {
musicDirectory = mkOption { musicDirectory = mkOption {
type = with types; either path (strMatching "(http|https|nfs|smb)://.+"); type = with types; either path (strMatching "(http|https|nfs|smb)://.+");
default = "${cfg.dataDir}/music"; default = "${cfg.dataDir}/music";
defaultText = "\${dataDir}/music"; defaultText = literalExpression ''"''${dataDir}/music"'';
description = '' description = ''
The directory or NFS/SMB network share where MPD reads music from. If left The directory or NFS/SMB network share where MPD reads music from. If left
as the default value this directory will automatically be created before as the default value this directory will automatically be created before
@ -86,7 +86,7 @@ in {
playlistDirectory = mkOption { playlistDirectory = mkOption {
type = types.path; type = types.path;
default = "${cfg.dataDir}/playlists"; default = "${cfg.dataDir}/playlists";
defaultText = "\${dataDir}/playlists"; defaultText = literalExpression ''"''${dataDir}/playlists"'';
description = '' description = ''
The directory where MPD stores playlists. If left as the default value The directory where MPD stores playlists. If left as the default value
this directory will automatically be created before the MPD server starts, this directory will automatically be created before the MPD server starts,
@ -155,7 +155,7 @@ in {
dbFile = mkOption { dbFile = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = "${cfg.dataDir}/tag_cache"; default = "${cfg.dataDir}/tag_cache";
defaultText = "\${dataDir}/tag_cache"; defaultText = literalExpression ''"''${dataDir}/tag_cache"'';
description = '' description = ''
The path to MPD's database. If set to <literal>null</literal> the The path to MPD's database. If set to <literal>null</literal> the
parameter is omitted from the configuration. parameter is omitted from the configuration.

View File

@ -22,7 +22,7 @@ in {
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.slimserver; default = pkgs.slimserver;
defaultText = "pkgs.slimserver"; defaultText = literalExpression "pkgs.slimserver";
description = "Slimserver package to use."; description = "Slimserver package to use.";
}; };

View File

@ -206,7 +206,7 @@ in {
For type <literal>meta</literal>, a list of stream names in the form <literal>/one/two/...</literal>. Don't forget the leading slash. For type <literal>meta</literal>, a list of stream names in the form <literal>/one/two/...</literal>. Don't forget the leading slash.
For type <literal>alsa</literal>, use an empty string. For type <literal>alsa</literal>, use an empty string.
''; '';
example = literalExample '' example = literalExpression ''
"/path/to/pipe" "/path/to/pipe"
"/path/to/librespot" "/path/to/librespot"
"192.168.1.2:4444" "192.168.1.2:4444"
@ -226,7 +226,7 @@ in {
description = '' description = ''
Key-value pairs that convey additional parameters about a stream. Key-value pairs that convey additional parameters about a stream.
''; '';
example = literalExample '' example = literalExpression ''
# for type == "pipe": # for type == "pipe":
{ {
mode = "create"; mode = "create";
@ -254,7 +254,7 @@ in {
description = '' description = ''
The definition for an input source. The definition for an input source.
''; '';
example = literalExample '' example = literalExpression ''
{ {
mpd = { mpd = {
type = "pipe"; type = "pipe";

View File

@ -26,7 +26,6 @@ in {
type = types.str; type = types.str;
default = "localhost"; default = "localhost";
description = "The host where MPD is listening."; description = "The host where MPD is listening.";
example = "localhost";
}; };
port = mkOption { port = mkOption {

View File

@ -2,7 +2,7 @@
let let
inherit (lib) concatMapStringsSep concatStringsSep isInt isList literalExample; inherit (lib) concatMapStringsSep concatStringsSep isInt isList literalExpression;
inherit (lib) mapAttrs mapAttrsToList mkDefault mkEnableOption mkIf mkOption optional types; inherit (lib) mapAttrs mapAttrsToList mkDefault mkEnableOption mkIf mkOption optional types;
cfg = config.services.automysqlbackup; cfg = config.services.automysqlbackup;
@ -48,7 +48,7 @@ in
<filename>''${pkgs.automysqlbackup}/etc/automysqlbackup.conf</filename> <filename>''${pkgs.automysqlbackup}/etc/automysqlbackup.conf</filename>
for details on supported values. for details on supported values.
''; '';
example = literalExample '' example = literalExpression ''
{ {
db_names = [ "nextcloud" "matomo" ]; db_names = [ "nextcloud" "matomo" ];
table_exclude = [ "nextcloud.oc_users" "nextcloud.oc_whats_new" ]; table_exclude = [ "nextcloud.oc_users" "nextcloud.oc_whats_new" ];

View File

@ -203,7 +203,7 @@ in {
See also the chapter about BorgBackup in the NixOS manual. See also the chapter about BorgBackup in the NixOS manual.
''; '';
default = { }; default = { };
example = literalExample '' example = literalExpression ''
{ # for a local backup { # for a local backup
rootBackup = { rootBackup = {
paths = "/"; paths = "/";
@ -260,7 +260,7 @@ in {
archiveBaseName = mkOption { archiveBaseName = mkOption {
type = types.strMatching "[^/{}]+"; type = types.strMatching "[^/{}]+";
default = "${globalConfig.networking.hostName}-${name}"; default = "${globalConfig.networking.hostName}-${name}";
defaultText = "\${config.networking.hostName}-<name>"; defaultText = literalExpression ''"''${config.networking.hostName}-<name>"'';
description = '' description = ''
How to name the created archives. A timestamp, whose format is How to name the created archives. A timestamp, whose format is
determined by <option>dateFormat</option>, will be appended. The full determined by <option>dateFormat</option>, will be appended. The full
@ -326,10 +326,7 @@ in {
you to specify a <option>passCommand</option> you to specify a <option>passCommand</option>
or a <option>passphrase</option>. or a <option>passphrase</option>.
''; '';
example = '' example = "repokey-blake2";
encryption.mode = "repokey-blake2" ;
encryption.passphrase = "mySecretPassphrase" ;
'';
}; };
encryption.passCommand = mkOption { encryption.passCommand = mkOption {
@ -437,7 +434,7 @@ in {
for the available options. for the available options.
''; '';
default = { }; default = { };
example = literalExample '' example = literalExpression ''
{ {
within = "1d"; # Keep all archives from the last day within = "1d"; # Keep all archives from the last day
daily = 7; daily = 7;
@ -455,7 +452,7 @@ in {
Use <literal>""</literal> to consider all archives. Use <literal>""</literal> to consider all archives.
''; '';
default = config.archiveBaseName; default = config.archiveBaseName;
defaultText = "\${archiveBaseName}"; defaultText = literalExpression "archiveBaseName";
}; };
environment = mkOption { environment = mkOption {

View File

@ -57,7 +57,7 @@ in
description = "Extra packages for btrbk, like compression utilities for <literal>stream_compress</literal>"; description = "Extra packages for btrbk, like compression utilities for <literal>stream_compress</literal>";
type = lib.types.listOf lib.types.package; type = lib.types.listOf lib.types.package;
default = [ ]; default = [ ];
example = lib.literalExample "[ pkgs.xz ]"; example = lib.literalExpression "[ pkgs.xz ]";
}; };
niceness = lib.mkOption { niceness = lib.mkOption {
description = "Niceness for local instances of btrbk. Also applies to remote ones connecting via ssh when positive."; description = "Niceness for local instances of btrbk. Also applies to remote ones connecting via ssh when positive.";

View File

@ -85,7 +85,7 @@ in {
backupAll = mkOption { backupAll = mkOption {
default = cfg.databases == []; default = cfg.databases == [];
defaultText = "services.postgresqlBackup.databases == []"; defaultText = literalExpression "services.postgresqlBackup.databases == []";
type = lib.types.bool; type = lib.types.bool;
description = '' description = ''
Backup all databases using pg_dumpall. Backup all databases using pg_dumpall.

Some files were not shown because too many files have changed in this diff Show More