about summary refs log tree commit diff
path: root/nixos/modules/services/web-apps/youtrack.nix
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2020-04-02 07:39:04 +0200
committerSilvan Mosberger <contact@infinisil.com>2020-04-02 07:49:25 +0200
commit1d0fc9729dd8564dc75b5fd020da6bd61e0346c0 (patch)
tree10ee602ed08d5ace4f98cf310cd78fca7e098d0d /nixos/modules/services/web-apps/youtrack.nix
parentf75c11cfdfff3448623250e151cb47df70d4f224 (diff)
downloadnixlib-1d0fc9729dd8564dc75b5fd020da6bd61e0346c0.tar
nixlib-1d0fc9729dd8564dc75b5fd020da6bd61e0346c0.tar.gz
nixlib-1d0fc9729dd8564dc75b5fd020da6bd61e0346c0.tar.bz2
nixlib-1d0fc9729dd8564dc75b5fd020da6bd61e0346c0.tar.lz
nixlib-1d0fc9729dd8564dc75b5fd020da6bd61e0346c0.tar.xz
nixlib-1d0fc9729dd8564dc75b5fd020da6bd61e0346c0.tar.zst
nixlib-1d0fc9729dd8564dc75b5fd020da6bd61e0346c0.zip
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.
Diffstat (limited to 'nixos/modules/services/web-apps/youtrack.nix')
-rw-r--r--nixos/modules/services/web-apps/youtrack.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/nixos/modules/services/web-apps/youtrack.nix b/nixos/modules/services/web-apps/youtrack.nix
index 830edac20bac..b4d653d2d77e 100644
--- a/nixos/modules/services/web-apps/youtrack.nix
+++ b/nixos/modules/services/web-apps/youtrack.nix
@@ -46,9 +46,11 @@ in
         https://www.jetbrains.com/help/youtrack/standalone/YouTrack-Java-Start-Parameters.html
         for more information.
       '';
-      example = {
-        "jetbrains.youtrack.overrideRootPassword" = "tortuga";
-      };
+      example = literalExample ''
+        {
+          "jetbrains.youtrack.overrideRootPassword" = "tortuga";
+        }
+      '';
       type = types.attrsOf types.str;
     };