git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #8630 from lihop/nixos/fix-formatting

nixos: fix formatting of option examples

commit04422bb3ca8f1c09ac45817f6926199f9bfbf84f authorDomen Kožar <domen@dev.si> dateSat 27 Feb 2016, 10:08 (11 years ago) parent13afef0392ca77
8 files changed+107−96
nixos/modules/config/vpnc.nix+10−10 nixos/modules/programs/freetds.nix+8−8 nixos/modules/security/ca.nix+11−8 nixos/modules/services/networking/nsd.nix+28−25 nixos/modules/services/security/fail2ban.nix+14−14 nixos/modules/services/web-servers/phpfpm.nix+13−12 nixos/modules/services/x11/xserver.nix+10−7 nixos/modules/system/activation/activation-script.nix+13−12
nixos/modules/config/vpnc.nix+10−10
@@ -17,16 +17,16 @@ in
1717 services = mkOption {
1818 type = types.attrsOf types.str;
1919 default = {};
20− example = {
21− test =
22− ''
23− IPSec gateway 192.168.1.1
24− IPSec ID someID
25− IPSec secret secretKey
26− Xauth username name
27− Xauth password pass
28− '';
29− };
20+ example = literalExample ''
21+ { test = '''
22+ IPSec gateway 192.168.1.1
23+ IPSec ID someID
24+ IPSec secret secretKey
25+ Xauth username name
26+ Xauth password pass
27+ ''';
28+ }
29+ '';
3030 description =
3131 ''
3232 The names of cisco VPNs and their associated definitions
nixos/modules/programs/freetds.nix+8−8
@@ -17,14 +17,14 @@ in
1717 environment.freetds = mkOption {
1818 type = types.attrsOf types.str;
1919 default = {};
20− example = {
21− MYDATABASE =
22− ''
23− host = 10.0.2.100
24− port = 1433
25− tds version = 7.2
26− '';
27− };
20+ example = literalExample ''
21+ { MYDATABASE = '''
22+ host = 10.0.2.100
23+ port = 1433
24+ tds version = 7.2
25+ ''';
26+ }
27+ '';
2828 description =
2929 ''
3030 Configure freetds database entries. Each attribute denotes
nixos/modules/security/ca.nix+11−8
@@ -35,14 +35,17 @@ in
3535 security.pki.certificates = mkOption {
3636 type = types.listOf types.str;
3737 default = [];
38− example = singleton ''
39− NixOS.org
40− =========
41− -----BEGIN CERTIFICATE-----
42− MIIGUDCCBTigAwIBAgIDD8KWMA0GCSqGSIb3DQEBBQUAMIGMMQswCQYDVQQGEwJJ
43− TDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0
44− ...
45− -----END CERTIFICATE-----
38+ example = literalExample ''
39+ [ '''
40+ NixOS.org
41+ =========
42+ -----BEGIN CERTIFICATE-----
43+ MIIGUDCCBTigAwIBAgIDD8KWMA0GCSqGSIb3DQEBBQUAMIGMMQswCQYDVQQGEwJJ
44+ TDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0
45+ ...
46+ -----END CERTIFICATE-----
47+ '''
48+ ]
4649 '';
4750 description = ''
4851 A list of trusted root certificates in PEM format.
nixos/modules/services/networking/nsd.nix+28−25
@@ -621,34 +621,37 @@ in
621621 zones = mkOption {
622622 type = types.attrsOf zoneOptions;
623623 default = {};
624− example = {
625− "serverGroup1" = {
626− provideXFR = [ "10.1.2.3 NOKEY" ];
627− children = {
628− "example.com." = {
629− data = ''
630− $ORIGIN example.com.
631− $TTL 86400
632− @ IN SOA a.ns.example.com. admin.example.com. (
633− ...
634− '';
635− };
636− "example.org." = {
637− data = ''
638− $ORIGIN example.org.
639− $TTL 86400
640− @ IN SOA a.ns.example.com. admin.example.com. (
641− ...
642− '';
624+ example = literalExample ''
625+ { "serverGroup1" = {
626+ provideXFR = [ "10.1.2.3 NOKEY" ];
627+ children = {
628+ "example.com." = {
629+ data = '''
630+ $ORIGIN example.com.
631+ $TTL 86400
632+ @ IN SOA a.ns.example.com. admin.example.com. (
633+ ...
634+ ''';
635+ };
636+ "example.org." = {
637+ data = '''
638+ $ORIGIN example.org.
639+ $TTL 86400
640+ @ IN SOA a.ns.example.com. admin.example.com. (
641+ ...
642+ ''';
643+ };
643644 };
644645 };
645− };
646646
647− "example.net." = {
648− provideXFR = [ "10.3.2.1 NOKEY" ];
649− data = ''...'';
650− };
651− };
647+ "example.net." = {
648+ provideXFR = [ "10.3.2.1 NOKEY" ];
649+ data = '''
650+ ...
651+ ''';
652+ };
653+ }
654+ '';
652655 description = ''
653656 Define your zones here. Zones can cascade other zones and therefore
654657 inherit settings from parent zones. Look at the definition of
nixos/modules/services/security/fail2ban.nix+14−14
@@ -50,20 +50,20 @@ in
5050
5151 jails = mkOption {
5252 default = { };
53− example =
54− { "apache-nohome-iptables" =
55− ''
56− # Block an IP address if it accesses a non-existent
57− # home directory more than 5 times in 10 minutes,
58− # since that indicates that it's scanning.
59− filter = apache-nohome
60− action = iptables-multiport[name=HTTP, port="http,https"]
61− logpath = /var/log/httpd/error_log*
62− findtime = 600
63− bantime = 600
64− maxretry = 5
65− '';
66− };
53+ example = literalExample ''
54+ { apache-nohome-iptables = '''
55+ # Block an IP address if it accesses a non-existent
56+ # home directory more than 5 times in 10 minutes,
57+ # since that indicates that it's scanning.
58+ filter = apache-nohome
59+ action = iptables-multiport[name=HTTP, port="http,https"]
60+ logpath = /var/log/httpd/error_log*
61+ findtime = 600
62+ bantime = 600
63+ maxretry = 5
64+ ''';
65+ }
66+ '';
6767 type = types.attrsOf types.lines;
6868 description =
6969 ''
nixos/modules/services/web-servers/phpfpm.nix+13−12
@@ -53,18 +53,19 @@ in {
5353 poolConfigs = mkOption {
5454 type = types.attrsOf types.lines;
5555 default = {};
56− example = {
57− mypool = ''
58− listen = /run/phpfpm/mypool
59− user = nobody
60− pm = dynamic
61− pm.max_children = 75
62− pm.start_servers = 10
63− pm.min_spare_servers = 5
64− pm.max_spare_servers = 20
65− pm.max_requests = 500
66− '';
67− };
56+ example = literalExample ''
57+ { mypool = '''
58+ listen = /run/phpfpm/mypool
59+ user = nobody
60+ pm = dynamic
61+ pm.max_children = 75
62+ pm.start_servers = 10
63+ pm.min_spare_servers = 5
64+ pm.max_spare_servers = 20
65+ pm.max_requests = 500
66+ ''';
67+ }
68+ '';
6869 description = ''
6970 A mapping between PHP FPM pool names and their configurations.
7071 See the documentation on <literal>php-fpm.conf</literal> for
nixos/modules/services/x11/xserver.nix+10−7
@@ -156,13 +156,16 @@ in
156156 inputClassSections = mkOption {
157157 type = types.listOf types.lines;
158158 default = [];
159− example = [ ''
160− Identifier "Trackpoint Wheel Emulation"
161− MatchProduct "ThinkPad USB Keyboard with TrackPoint"
162− Option "EmulateWheel" "true
163− Option "EmulateWheelButton" "2"
164− Option "Emulate3Buttons" "false"
165− '' ];
159+ example = literalExample ''
160+ [ '''
161+ Identifier "Trackpoint Wheel Emulation"
162+ MatchProduct "ThinkPad USB Keyboard with TrackPoint"
163+ Option "EmulateWheel" "true
164+ Option "EmulateWheelButton" "2"
165+ Option "Emulate3Buttons" "false"
166+ '''
167+ ]
168+ '';
166169 description = "Content of additional InputClass sections of the X server configuration file.";
167170 };
168171
nixos/modules/system/activation/activation-script.nix+13−12
@@ -30,18 +30,19 @@ in
3030 system.activationScripts = mkOption {
3131 default = {};
3232
33− example = {
34− stdio = {
35− text = ''
36− # Needed by some programs.
37− ln -sfn /proc/self/fd /dev/fd
38− ln -sfn /proc/self/fd/0 /dev/stdin
39− ln -sfn /proc/self/fd/1 /dev/stdout
40− ln -sfn /proc/self/fd/2 /dev/stderr
41− '';
42− deps = [];
43− };
44− };
33+ example = literalExample ''
34+ { stdio = {
35+ text = '''
36+ # Needed by some programs.
37+ ln -sfn /proc/self/fd /dev/fd
38+ ln -sfn /proc/self/fd/0 /dev/stdin
39+ ln -sfn /proc/self/fd/1 /dev/stdout
40+ ln -sfn /proc/self/fd/2 /dev/stderr
41+ ''';
42+ deps = [];
43+ };
44+ }
45+ '';
4546
4647 description = ''
4748 A set of shell script fragments that are executed when a NixOS