1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs synced 2024-10-19 03:47:13 -04:00
nixpkgs/nixos/modules/virtualisation
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
..
amazon-image.nix
amazon-init.nix
amazon-options.nix
anbox.nix
azure-agent-entropy.patch
azure-agent.nix
azure-bootstrap-blobs.nix
azure-common.nix
azure-config-user.nix
azure-config.nix
azure-image.nix azure: init nixos/maintainers/scripts/azure-new 2020-03-29 13:56:55 -07:00
azure-images.nix
brightbox-config.nix
brightbox-image.nix
cloudstack-config.nix
container-config.nix
containers.nix nixos/treewide: Fix incorrectly rendered examples 2020-04-02 07:49:25 +02:00
cri-o.nix
digital-ocean-config.nix
digital-ocean-image.nix
digital-ocean-init.nix
docker-containers.nix
docker-image.nix
docker-preloader.nix
docker.nix
ec2-amis.nix
ec2-data.nix
ec2-metadata-fetcher.nix
ecs-agent.nix
gce-images.nix
google-compute-config.nix
google-compute-image.nix
grow-partition.nix
hyperv-guest.nix
kvmgt.nix
libvirtd.nix libvirt: fix escapeShellArg usage 2020-03-30 09:45:28 +00:00
lxc-container.nix
lxc.nix
lxcfs.nix
lxd.nix
openstack-config.nix
openvswitch.nix
parallels-guest.nix
qemu-guest-agent.nix
qemu-vm.nix
railcar.nix
rkt.nix
virtualbox-guest.nix
virtualbox-host.nix
virtualbox-image.nix
vmware-guest.nix
xe-guest-utilities.nix
xen-dom0.nix
xen-domU.nix