about summary refs log tree commit diff
path: root/doc/doc-support
diff options
context:
space:
mode:
authorSilvan Mosberger <silvan.mosberger@tweag.io>2022-12-23 20:57:49 +0100
committerSilvan Mosberger <silvan.mosberger@tweag.io>2022-12-23 21:10:43 +0100
commit8496683ec95f26b00035b5a965021dfffae269a6 (patch)
tree8f4feb2d4a98ada16dace6f49947b16649cee251 /doc/doc-support
parentb3792b44c55ce58147055e553cd45f1f04ca3e51 (diff)
lib: Allow doc rendering for lib/<name>/default.nix
Diffstat (limited to 'doc/doc-support')
-rw-r--r--doc/doc-support/lib-function-docs.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/doc/doc-support/lib-function-docs.nix b/doc/doc-support/lib-function-docs.nix
index d6fa08aa96205..cf218fa704017 100644
--- a/doc/doc-support/lib-function-docs.nix
+++ b/doc/doc-support/lib-function-docs.nix
@@ -10,7 +10,11 @@ with pkgs; stdenv.mkDerivation {
   installPhase = ''
     function docgen {
       # TODO: wrap lib.$1 in <literal>, make nixdoc not escape it
-      nixdoc -c "$1" -d "lib.$1: $2" -f "$1.nix" > "$out/$1.xml"
+      if [[ -e "../lib/$1.nix" ]]; then
+        nixdoc -c "$1" -d "lib.$1: $2" -f "$1.nix" > "$out/$1.xml"
+      else
+        nixdoc -c "$1" -d "lib.$1: $2" -f "$1/default.nix" > "$out/$1.xml"
+      fi
       echo "<xi:include href='$1.xml' />" >> "$out/index.xml"
     }