nixpkgs/nixos
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
..
doc Merge pull request #83617 from Ma27/mongodb-changelog 2020-03-31 22:03:03 +02:00
lib Revert "make-options-doc: fix string context issues" 2020-04-02 00:53:54 +02:00
maintainers nixos/azure: clarify how users work in basic example 2020-03-29 13:56:55 -07:00
modules nixos/treewide: Fix incorrectly rendered examples 2020-04-02 07:49:25 +02:00
tests Merge pull request #83894 from symphorien/unbreak-os-prober-test 2020-03-31 22:17:27 +02:00
COPYING
default.nix
README
release-combined.nix release-combined.tested: readd boot.biosUsb test 2020-02-22 10:43:26 +01:00
release-small.nix nixos/release-small.nix: Export options job 2020-03-24 21:17:53 +01:00
release.nix nixos/release.nix: Import './..' instead of nixpkgs 2020-02-12 22:44:59 +01:00

*** NixOS ***

NixOS is a Linux distribution based on the purely functional package
management system Nix.  More information can be found at
http://nixos.org/nixos and in the manual in doc/manual.