about summary refs log tree commit diff
path: root/doc/doc-support/options-doc.nix
blob: aa24f16901c57371067e37524d243d1a8d51d34c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# To build this derivation, run `nix-build -A nixpkgs-manual.optionsDoc`
{ lib, nixosOptionsDoc }:

let
  modules = lib.evalModules {
    modules = [ ../../pkgs/top-level/config.nix ];
    class = "nixpkgsConfig";
  };

  root = toString ../..;

  transformDeclaration =
    decl:
    let
      declStr = toString decl;
      subpath = lib.removePrefix "/" (lib.removePrefix root declStr);
    in
    assert lib.hasPrefix root declStr;
    {
      url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}";
      name = subpath;
    };
in
nixosOptionsDoc {
  inherit (modules) options;
  documentType = "none";
  transformOptions = opt: opt // { declarations = map transformDeclaration opt.declarations; };
}