nixos/manual: Use literalExample when feasible.

Should bring most of the examples into a better consistency regarding
syntactic representation in the manual.

Thanks to @devhell for reporting.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2014-08-27 23:41:15 +02:00
parent 9667a4067c
commit 8a56a55bb4
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961
18 changed files with 39 additions and 27 deletions

View File

@ -11,7 +11,7 @@ with lib;
# TODO: find another name for it. # TODO: find another name for it.
fonts = mkOption { fonts = mkOption {
type = types.listOf types.path; type = types.listOf types.path;
example = [ pkgs.dejavu_fonts ]; example = literalExample "[ pkgs.dejavu_fonts ]";
description = "List of primary font paths."; description = "List of primary font paths.";
apply = list: list ++ apply = list: list ++
[ # - the user's current profile [ # - the user's current profile

View File

@ -35,7 +35,9 @@ in
powerUpCommands = mkOption { powerUpCommands = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"; example = literalExample ''
"''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"
'';
description = description =
'' ''
Commands executed when the machine powers up. That is, Commands executed when the machine powers up. That is,
@ -47,7 +49,9 @@ in
powerDownCommands = mkOption { powerDownCommands = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"; example = literalExample ''
"''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"
'';
description = description =
'' ''
Commands executed when the machine powers down. That is, Commands executed when the machine powers down. That is,

View File

@ -81,7 +81,7 @@ in {
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pulseaudioFull; default = pulseaudioFull;
example = literalExample "pulseaudioFull"; example = literalExample "pkgs.pulseaudioFull";
description = '' description = ''
The PulseAudio derivation to use. This can be used to disable The PulseAudio derivation to use. This can be used to disable
features (such as JACK support, Bluetooth) that are enabled in the features (such as JACK support, Bluetooth) that are enabled in the

View File

@ -122,7 +122,9 @@ in
environment.binsh = mkOption { environment.binsh = mkOption {
default = "${config.system.build.binsh}/bin/sh"; default = "${config.system.build.binsh}/bin/sh";
example = "\${pkgs.dash}/bin/dash"; example = literalExample ''
"''${pkgs.dash}/bin/dash"
'';
type = types.path; type = types.path;
description = '' description = ''
The shell executable that is linked system-wide to The shell executable that is linked system-wide to

View File

@ -113,11 +113,12 @@ in
}; };
isoImage.contents = mkOption { isoImage.contents = mkOption {
example = example = literalExample ''
[ { source = pkgs.memtest86 + "/memtest.bin"; [ { source = pkgs.memtest86 + "/memtest.bin";
target = "boot/memtest.bin"; target = "boot/memtest.bin";
} }
]; ]
'';
description = '' description = ''
This option lists files to be copied to fixed locations in the This option lists files to be copied to fixed locations in the
generated ISO image. generated ISO image.
@ -125,7 +126,7 @@ in
}; };
isoImage.storeContents = mkOption { isoImage.storeContents = mkOption {
example = [pkgs.stdenv]; example = literalExample "[ 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,11 +15,12 @@ in
{ {
options = { options = {
tarball.contents = mkOption { tarball.contents = mkOption {
example = example = literalExample ''
[ { source = pkgs.memtest86 + "/memtest.bin"; [ { source = pkgs.memtest86 + "/memtest.bin";
target = "boot/memtest.bin"; target = "boot/memtest.bin";
} }
]; ]
'';
description = '' description = ''
This option lists files to be copied to fixed locations in the This option lists files to be copied to fixed locations in the
generated ISO image. generated ISO image.
@ -27,7 +28,7 @@ in
}; };
tarball.storeContents = mkOption { tarball.storeContents = mkOption {
example = [pkgs.stdenv]; example = literalExample "[ 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

@ -28,7 +28,7 @@ in
# We don't want to evaluate all of linuxPackages for the manual # We don't want to evaluate all of linuxPackages for the manual
# - some of it might not even evaluate correctly. # - some of it might not even evaluate correctly.
defaultText = "pkgs.linuxPackages"; defaultText = "pkgs.linuxPackages";
example = "pkgs.linuxPackages_2_6_25"; example = literalExample "pkgs.linuxPackages_2_6_25";
description = '' description = ''
This will override the boot.kernelPackages, and will add some This will override the boot.kernelPackages, and will add some
kernel configuration parameters for the crash dump to work. kernel configuration parameters for the crash dump to work.

View File

@ -49,7 +49,7 @@ in {
extensionPackages = mkOption { extensionPackages = mkOption {
default = []; default = [];
type = types.listOf types.package; type = types.listOf types.package;
example = [ mopidy-spotify ]; example = literalExample "[ 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

@ -31,7 +31,7 @@ in
cronIntervals = mkOption { cronIntervals = mkOption {
default = {}; default = {};
example = { "hourly" = "0 * * * *"; "daily" = "50 21 * * *"; }; example = { hourly = "0 * * * *"; daily = "50 21 * * *"; };
type = types.attrsOf types.string; type = types.attrsOf types.string;
description = '' description = ''
Periodicity at which intervals should be run by cron. Periodicity at which intervals should be run by cron.

View File

@ -49,7 +49,9 @@ in {
extraModulePaths = mkOption { extraModulePaths = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
example = [ "${pkgs.syslogng_incubator}/lib/syslog-ng" ]; example = literalExample ''
[ "''${pkgs.syslogng_incubator}/lib/syslog-ng" ]
'';
description = '' description = ''
A list of paths that should be included in syslog-ng's A list of paths that should be included in syslog-ng's
<literal>--module-path</literal> option. They should usually <literal>--module-path</literal> option. They should usually

View File

@ -62,7 +62,7 @@ in
enable = mkOption { enable = mkOption {
default = false; default = false;
type = types.bool; type = types.bool;
example = "true"; example = true;
description = '' description = ''
Run smartd from the smartmontools package. Note that e-mail Run smartd from the smartmontools package. Note that e-mail
notifications will not be enabled unless you configure the list of notifications will not be enabled unless you configure the list of

View File

@ -66,7 +66,7 @@ in
rsaKey = mkOption { rsaKey = mkOption {
default = null; default = null;
example = /root/certificates/irc.key; example = literalExample "/root/certificates/irc.key";
description = " description = "
IRCD server RSA key. IRCD server RSA key.
"; ";
@ -74,7 +74,7 @@ in
certificate = mkOption { certificate = mkOption {
default = null; default = null;
example = /root/certificates/irc.pem; example = literalExample "/root/certificates/irc.pem";
description = " description = "
IRCD server SSL certificate. There are some limitations - read manual. IRCD server SSL certificate. There are some limitations - read manual.
"; ";

View File

@ -228,7 +228,7 @@ in
modulePackages = mkOption { modulePackages = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = [ ]; default = [ ];
example = [ pkgs.zncModules.fish pkgs.zncModules.push ]; example = literalExample "[ pkgs.zncModules.fish pkgs.zncModules.push ]";
description = '' description = ''
A list of global znc module packages to add to znc. A list of global znc module packages to add to znc.
''; '';

View File

@ -423,7 +423,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; }; default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; };
example = "pkgs.apacheHttpd_2_4"; example = literalExample "pkgs.apacheHttpd_2_4";
description = '' description = ''
Overridable attribute of the Apache HTTP Server package to use. Overridable attribute of the Apache HTTP Server package to use.
''; '';

View File

@ -37,7 +37,7 @@ in {
services.xserver.desktopManager.gnome3.sessionPath = mkOption { services.xserver.desktopManager.gnome3.sessionPath = mkOption {
default = []; default = [];
example = "[ pkgs.gnome3.gpaste ]"; example = literalExample "[ pkgs.gnome3.gpaste ]";
description = "Additional list of packages to be added to the session search path. description = "Additional list of packages to be added to the session search path.
Useful for gnome shell extensions or gsettings-conditionated autostart."; Useful for gnome shell extensions or gsettings-conditionated autostart.";
apply = list: list ++ [ gnome3.gnome_shell ]; apply = list: list ++ [ gnome3.gnome_shell ];
@ -51,7 +51,7 @@ in {
environment.gnome3.excludePackages = mkOption { environment.gnome3.excludePackages = mkOption {
default = []; default = [];
example = "[ pkgs.gnome3.totem ]"; example = literalExample "[ pkgs.gnome3.totem ]";
type = types.listOf types.package; type = types.listOf types.package;
description = "Which packages gnome should exclude from the default environment"; description = "Which packages gnome should exclude from the default environment";
}; };

View File

@ -65,7 +65,7 @@ in
environment.kdePackages = mkOption { environment.kdePackages = mkOption {
default = []; default = [];
example = "[ pkgs.kde4.kdesdk ]"; example = literalExample "[ pkgs.kde4.kdesdk ]";
type = types.listOf types.package; type = types.listOf types.package;
description = "This option is obsolete. Please use <option>environment.systemPackages</option> instead."; description = "This option is obsolete. Please use <option>environment.systemPackages</option> instead.";
}; };

View File

@ -251,14 +251,16 @@ in
execCmd = mkOption { execCmd = mkOption {
type = types.str; type = types.str;
example = "${pkgs.slim}/bin/slim"; example = literalExample ''
"''${pkgs.slim}/bin/slim"
'';
description = "Command to start the display manager."; description = "Command to start the display manager.";
}; };
environment = mkOption { environment = mkOption {
type = types.attrsOf types.unspecified; type = types.attrsOf types.unspecified;
default = {}; default = {};
example = { SLIM_CFGFILE = /etc/slim.conf; }; example = { SLIM_CFGFILE = "/etc/slim.conf"; };
description = "Additional environment variables needed by the display manager."; description = "Additional environment variables needed by the display manager.";
}; };

View File

@ -151,7 +151,7 @@ in
modules = mkOption { modules = mkOption {
type = types.listOf types.path; type = types.listOf types.path;
default = []; default = [];
example = [ pkgs.xf86_input_wacom ]; example = literalExample "[ pkgs.xf86_input_wacom ]";
description = "Packages to be added to the module search path of the X server."; description = "Packages to be added to the module search path of the X server.";
}; };
@ -201,7 +201,7 @@ in
vaapiDrivers = mkOption { vaapiDrivers = mkOption {
type = types.listOf types.path; type = types.listOf types.path;
default = [ ]; default = [ ];
example = "[ pkgs.vaapiIntel pkgs.vaapiVdpau ]"; example = literalExample "[ pkgs.vaapiIntel pkgs.vaapiVdpau ]";
description = '' description = ''
Packages providing libva acceleration drivers. Packages providing libva acceleration drivers.
''; '';