1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/modules/services/network-filesystems
Silvan Mosberger 1d0fc9729d
nixos/treewide: Fix incorrectly rendered examples
Many options define their example to be a Nix value without using
literalExample. This sometimes gets rendered incorrectly in the manual,
causing confusion like in https://github.com/NixOS/nixpkgs/issues/25516

This fixes it by using literalExample for such options. The list of
option to fix was determined with this expression:

  let
    nixos = import ./nixos { configuration = {}; };
    lib = import ./lib;
    valid = d: {
      # escapeNixIdentifier from https://github.com/NixOS/nixpkgs/pull/82461
      set = lib.all (n: lib.strings.escapeNixIdentifier n == n) (lib.attrNames d) && lib.all (v: valid v) (lib.attrValues d);
      list = lib.all (v: valid v) d;
    }.${builtins.typeOf d} or true;

    optionList = lib.optionAttrSetToDocList nixos.options;

  in map (opt: {
    file = lib.elemAt opt.declarations 0;
    loc = lib.options.showOption opt.loc;
  }) (lib.filter (opt: if opt ? example then ! valid opt.example else false) optionList)

which when evaluated will output all options that use a Nix identifier
that would need escaping as an attribute name.
2020-04-02 07:49:25 +02:00
..
openafs
orangefs nixos/orangefs: add modules for server and client 2019-09-25 14:17:08 +02:00
cachefilesd.nix
ceph.nix treewide: use attrs instead of list for types.loaOf options 2020-01-06 10:39:18 -05:00
davfs2.nix treewide: use attrs instead of list for types.loaOf options 2020-01-06 10:39:18 -05:00
diod.nix
drbd.nix treewide: use attrs instead of list for types.loaOf options 2020-01-06 10:39:18 -05:00
glusterfs.nix
ipfs.nix
kbfs.nix nixos/keybase, nixos/kbfs: update service configs; add redirector 2019-12-23 22:55:06 -08:00
netatalk.nix nixos/treewide: Fix incorrectly rendered examples 2020-04-02 07:49:25 +02:00
nfsd.nix nixos/treewide: Move rename.nix imports to their respective modules 2019-12-10 02:51:19 +01:00
rsyncd.nix nixos/treewide: Fix incorrectly rendered examples 2020-04-02 07:49:25 +02:00
samba.nix nixos/treewide: Fix incorrectly rendered examples 2020-04-02 07:49:25 +02:00
tahoe.nix
u9fs.nix
xtreemfs.nix
yandex-disk.nix