Skip to content

Commit

Permalink
nixos/wpa_supplicant: use literalExample
Browse files Browse the repository at this point in the history
For various reasons, big Nix attrsets look ugly in the generated manual
page[1]. Use literalExample to fix it.

[1] Quotes around attribute names are lost, newlines inside multi-line
strings are shown as '\n' and attrs written on multiple lines are joined
into one.
  • Loading branch information
bjornfor committed Sep 15, 2017
1 parent 990ea87 commit 6b7a937
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions nixos/modules/services/networking/supplicant.nix
Expand Up @@ -181,18 +181,19 @@ in

default = { };

example = {
"wlan0 wlan1" = {
configFile = "/etc/wpa_supplicant";
userControlled.group = "network";
extraConf = ''
ap_scan=1
p2p_disabled=1
'';
extraCmdArgs = "-u -W";
bridge = "br0";
};
};
example = literalExample ''
{ "wlan0 wlan1" = {
configFile = "/etc/wpa_supplicant";
userControlled.group = "network";
extraConf = '''
ap_scan=1
p2p_disabled=1
''';
extraCmdArgs = "-u -W";
bridge = "br0";
};
}
'';

description = ''
Interfaces for which to start <command>wpa_supplicant</command>.
Expand Down

2 comments on commit 6b7a937

@bjornfor
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edolstra, @nbp: Would it make sense / be possible to pretty print Nix attrsets differently in the manual? It seems a bit pointless to make fixes like I just did here :-)

@nbp
Copy link
Member

@nbp nbp commented on 6b7a937 Sep 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjornfor Have a look at https://github.com/NixOS/nixos-homepage/blob/4f601ba09e5f229529e6b1c5a570d53528c761f4/nixos/options.tt#L147

If I recall correctly I wrote this code during the 2nd Lubljana meetup:
https://github.com/qknight/nixos-search-options/blame/master/index.html#L170

So I guess I might be the right person to ask for review too.

Please sign in to comment.