diff --git a/docs/docgen.nix b/docs/docgen.nix index b63b181..f9de95d 100644 --- a/docs/docgen.nix +++ b/docs/docgen.nix @@ -9,6 +9,7 @@ "^docs/.*" ], + linkToRepo ? false, }: stdenvNoCC.mkDerivation { @@ -79,6 +80,25 @@ stdenvNoCC.mkDerivation { moduleOptionsDoc = (nixosOptionsDoc { options = lib.removeAttrs modulesEval.options [ "_module" ]; + transformOptions = + opt: + opt + // { + declarations = map ( + decl: + let + file = toString decl; + in + { + name = relPath file; + url = + if linkToRepo then + "https://git.shellgod.icu/Sk7Str1p3/nixos/src/branch/main/${relPath file}" + else + "file://${decl}"; + } + ) opt.declarations; + }; }).optionsCommonMark; in {