git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #84074 from Infinisil/fix-literal-option-examples

nixos/treewide: Fix incorrectly rendered examples

commiteb0148e90b3e35730dab3c668bf93e4cb5d8e633 authorSilvan Mosberger <contact@infinisil.com> dateFri 3 Apr 2020, 15:41 (7 years ago) parentaa600361d0fc97
13 files changed+92−59
nixos/modules/services/amqp/activemq/default.nix+5−3 nixos/modules/services/backup/syncoid.nix+5−1 nixos/modules/services/cluster/hadoop/default.nix+20−12 nixos/modules/services/network-filesystems/netatalk.nix+3−2 nixos/modules/services/network-filesystems/rsyncd.nix+3−2 nixos/modules/services/network-filesystems/samba.nix+3−2 nixos/modules/services/networking/3proxy.nix+6−4 nixos/modules/services/networking/dnscache.nix+6−4 nixos/modules/services/networking/ndppd.nix+7−3 nixos/modules/services/networking/strongswan.nix+16−14 nixos/modules/services/networking/syncthing.nix+8−6 nixos/modules/services/web-apps/youtrack.nix+5−3 nixos/modules/virtualisation/containers.nix+5−3
nixos/modules/services/amqp/activemq/default.nix+5−3
@@ -63,9 +63,11 @@ in {
6363 javaProperties = mkOption {
6464 type = types.attrs;
6565 default = { };
66− example = {
67− "java.net.preferIPv4Stack" = "true";
68− };
66+ example = literalExample ''
67+ {
68+ "java.net.preferIPv4Stack" = "true";
69+ }
70+ '';
6971 apply = attrs: {
7072 "activemq.base" = "${cfg.baseDir}";
7173 "activemq.data" = "${cfg.baseDir}/data";
nixos/modules/services/backup/syncoid.nix+5−1
@@ -138,7 +138,11 @@ in {
138138 };
139139 }));
140140 default = {};
141− example."pool/test".target = "root@target:pool/test";
141+ example = literalExample ''
142+ {
143+ "pool/test".target = "root@target:pool/test";
144+ }
145+ '';
142146 description = "Syncoid commands to run.";
143147 };
144148 };
nixos/modules/services/cluster/hadoop/default.nix+20−12
@@ -7,33 +7,41 @@ with lib;
77 options.services.hadoop = {
88 coreSite = mkOption {
99 default = {};
10− example = {
11− "fs.defaultFS" = "hdfs://localhost";
12− };
10+ example = literalExample ''
11+ {
12+ "fs.defaultFS" = "hdfs://localhost";
13+ }
14+ '';
1315 description = "Hadoop core-site.xml definition";
1416 };
1517
1618 hdfsSite = mkOption {
1719 default = {};
18− example = {
19− "dfs.nameservices" = "namenode1";
20− };
20+ example = literalExample ''
21+ {
22+ "dfs.nameservices" = "namenode1";
23+ }
24+ '';
2125 description = "Hadoop hdfs-site.xml definition";
2226 };
2327
2428 mapredSite = mkOption {
2529 default = {};
26− example = {
27− "mapreduce.map.cpu.vcores" = "1";
28− };
30+ example = literalExample ''
31+ {
32+ "mapreduce.map.cpu.vcores" = "1";
33+ }
34+ '';
2935 description = "Hadoop mapred-site.xml definition";
3036 };
3137
3238 yarnSite = mkOption {
3339 default = {};
34− example = {
35− "yarn.resourcemanager.ha.id" = "resourcemanager1";
36− };
40+ example = literalExample ''
41+ {
42+ "yarn.resourcemanager.ha.id" = "resourcemanager1";
43+ }
44+ '';
3745 description = "Hadoop yarn-site.xml definition";
3846 };
3947
nixos/modules/services/network-filesystems/netatalk.nix+3−2
@@ -98,13 +98,14 @@ in
9898 Set of AFP volumes to export.
9999 See <literal>man apf.conf</literal> for more information.
100100 '';
101− example =
101+ example = literalExample ''
102102 { srv =
103103 { path = "/srv";
104104 "read only" = true;
105105 "hosts allow" = "10.1.0.0/16 10.2.1.100 2001:0db8:1234::/48";
106106 };
107− };
107+ }
108+ '';
108109 };
109110
110111 extmap = mkOption {
nixos/modules/services/network-filesystems/rsyncd.nix+3−2
@@ -74,13 +74,14 @@ in
7474 See <command>man rsyncd.conf</command> for options.
7575 '';
7676 type = types.attrsOf (types.attrsOf types.str);
77− example =
77+ example = literalExample ''
7878 { srv =
7979 { path = "/srv";
8080 "read only" = "yes";
8181 comment = "Public rsync share.";
8282 };
83− };
83+ }
84+ '';
8485 };
8586
8687 user = mkOption {
nixos/modules/services/network-filesystems/samba.nix+3−2
@@ -189,7 +189,7 @@ in
189189 See <command>man smb.conf</command> for options.
190190 '';
191191 type = types.attrsOf (types.attrsOf types.unspecified);
192− example =
192+ example = literalExample ''
193193 { public =
194194 { path = "/srv/public";
195195 "read only" = true;
@@ -197,7 +197,8 @@ in
197197 "guest ok" = "yes";
198198 comment = "Public samba share.";
199199 };
200− };
200+ }
201+ '';
201202 };
202203
203204 };
nixos/modules/services/networking/3proxy.nix+6−4
@@ -334,10 +334,12 @@ in {
334334 nsrecord = mkOption {
335335 type = types.attrsOf types.str;
336336 default = { };
337− example = {
338− "files.local" = "192.168.1.12";
339− "site.local" = "192.168.1.43";
340− };
337+ example = literalExample ''
338+ {
339+ "files.local" = "192.168.1.12";
340+ "site.local" = "192.168.1.43";
341+ }
342+ '';
341343 description = "Adds static nsrecords.";
342344 };
343345 };
nixos/modules/services/networking/dnscache.nix+6−4
@@ -61,10 +61,12 @@ in {
6161 Table of {hostname: server} pairs to use as authoritative servers for hosts (and subhosts).
6262 If entry for @ is not specified predefined list of root servers is used.
6363 '';
64− example = {
65− "@" = ["8.8.8.8" "8.8.4.4"];
66− "example.com" = ["192.168.100.100"];
67− };
64+ example = literalExample ''
65+ {
66+ "@" = ["8.8.8.8" "8.8.4.4"];
67+ "example.com" = ["192.168.100.100"];
68+ }
69+ '';
6870 };
6971
7072 forwardOnly = mkOption {
nixos/modules/services/networking/ndppd.nix+7−3
@@ -43,7 +43,7 @@ let
4343 timeout = mkOption {
4444 type = types.int;
4545 description = ''
46− Controls how long to wait for a Neighbor Advertisment Message before
46+ Controls how long to wait for a Neighbor Advertisment Message before
4747 invalidating the entry, in milliseconds.
4848 '';
4949 default = 500;
@@ -51,7 +51,7 @@ let
5151 ttl = mkOption {
5252 type = types.int;
5353 description = ''
54− Controls how long a valid or invalid entry remains in the cache, in
54+ Controls how long a valid or invalid entry remains in the cache, in
5555 milliseconds.
5656 '';
5757 default = 30000;
@@ -142,7 +142,11 @@ in {
142142 messages, and respond to them according to a set of rules.
143143 '';
144144 default = {};
145− example = { eth0.rules."1111::/64" = {}; };
145+ example = literalExample ''
146+ {
147+ eth0.rules."1111::/64" = {};
148+ }
149+ '';
146150 };
147151 };
148152
nixos/modules/services/networking/strongswan.nix+16−14
@@ -4,7 +4,7 @@ let
44
55 inherit (builtins) toFile;
66 inherit (lib) concatMapStringsSep concatStringsSep mapAttrsToList
7− mkIf mkEnableOption mkOption types;
7+ mkIf mkEnableOption mkOption types literalExample;
88
99 cfg = config.services.strongswan;
1010
@@ -79,19 +79,21 @@ in
7979 connections = mkOption {
8080 type = types.attrsOf (types.attrsOf types.str);
8181 default = {};
82− example = {
83− "%default" = {
84− keyexchange = "ikev2";
85− keyingtries = "1";
86− };
87− roadwarrior = {
88− auto = "add";
89− leftcert = "/run/keys/moonCert.pem";
90− leftid = "@moon.strongswan.org";
91− leftsubnet = "10.1.0.0/16";
92− right = "%any";
93− };
94− };
82+ example = literalExample ''
83+ {
84+ "%default" = {
85+ keyexchange = "ikev2";
86+ keyingtries = "1";
87+ };
88+ roadwarrior = {
89+ auto = "add";
90+ leftcert = "/run/keys/moonCert.pem";
91+ leftid = "@moon.strongswan.org";
92+ leftsubnet = "10.1.0.0/16";
93+ right = "%any";
94+ };
95+ }
96+ '';
9597 description = ''
9698 A set of connections and their options for the ‘conn xxx’
9799 sections of the <filename>ipsec.conf</filename> file.
nixos/modules/services/networking/syncthing.nix+8−6
@@ -169,12 +169,14 @@ in {
169169 description = ''
170170 folders which should be shared by syncthing.
171171 '';
172− example = {
173− "/home/user/sync" = {
174− id = "syncme";
175− devices = [ "bigbox" ];
176− };
177− };
172+ example = literalExample ''
173+ {
174+ "/home/user/sync" = {
175+ id = "syncme";
176+ devices = [ "bigbox" ];
177+ };
178+ }
179+ '';
178180 type = types.attrsOf (types.submodule ({ name, ... }: {
179181 options = {
180182
nixos/modules/services/web-apps/youtrack.nix+5−3
@@ -46,9 +46,11 @@ in
4646 https://www.jetbrains.com/help/youtrack/standalone/YouTrack-Java-Start-Parameters.html
4747 for more information.
4848 '';
49− example = {
50− "jetbrains.youtrack.overrideRootPassword" = "tortuga";
51− };
49+ example = literalExample ''
50+ {
51+ "jetbrains.youtrack.overrideRootPassword" = "tortuga";
52+ }
53+ '';
5254 type = types.attrsOf types.str;
5355 };
5456
nixos/modules/virtualisation/containers.nix+5−3
@@ -609,9 +609,11 @@ in
609609 bindMounts = mkOption {
610610 type = with types; loaOf (submodule bindMountOpts);
611611 default = {};
612− example = { "/home" = { hostPath = "/home/alice";
613− isReadOnly = false; };
614− };
612+ example = literalExample ''
613+ { "/home" = { hostPath = "/home/alice";
614+ isReadOnly = false; };
615+ }
616+ '';
615617
616618 description =
617619 ''