diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2023-01-03 13:46:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-03 13:46:11 +0100 |
commit | f61d4d346bcacb4967a4f259280682279e9db7c5 (patch) | |
tree | a8b90c69d35f8242bc586ef2d82c246a70e8a835 /doc | |
parent | d52db30a7d5cfd7ea34ac87f2b873432fd3076ab (diff) | |
parent | 0667ef5dd5cc7aa00e7d5ebf4391b7ee1d414a0c (diff) |
Merge pull request #205190 from NixOS/lib.path.relativeNormalise
lib.path.subpath.{isValid,normalise}: init
Diffstat (limited to 'doc')
-rw-r--r-- | doc/doc-support/default.nix | 1 | ||||
-rw-r--r-- | doc/doc-support/lib-function-docs.nix | 6 | ||||
-rw-r--r-- | doc/doc-support/lib-function-locations.nix | 16 |
3 files changed, 15 insertions, 8 deletions
diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix index ec180064c35d8..e9cb96e37fdd5 100644 --- a/doc/doc-support/default.nix +++ b/doc/doc-support/default.nix @@ -12,6 +12,7 @@ let { name = "lists"; description = "list manipulation functions"; } { name = "debug"; description = "debugging functions"; } { name = "options"; description = "NixOS / nixpkgs option handling"; } + { name = "path"; description = "path functions"; } { name = "filesystem"; description = "filesystem functions"; } { name = "sources"; description = "source filtering functions"; } { name = "cli"; description = "command-line serialization functions"; } 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" } diff --git a/doc/doc-support/lib-function-locations.nix b/doc/doc-support/lib-function-locations.nix index ae1123c63ad30..3ede09ba50f58 100644 --- a/doc/doc-support/lib-function-locations.nix +++ b/doc/doc-support/lib-function-locations.nix @@ -2,19 +2,21 @@ let revision = pkgs.lib.trivial.revisionWithDefault (nixpkgs.revision or "master"); - libDefPos = set: - builtins.map - (name: { - name = name; + libDefPos = prefix: set: + builtins.concatMap + (name: [{ + name = builtins.concatStringsSep "." (prefix ++ [name]); location = builtins.unsafeGetAttrPos name set; - }) - (builtins.attrNames set); + }] ++ nixpkgsLib.optionals + (builtins.length prefix == 0 && builtins.isAttrs set.${name}) + (libDefPos (prefix ++ [name]) set.${name}) + ) (builtins.attrNames set); libset = toplib: builtins.map (subsetname: { subsetname = subsetname; - functions = libDefPos toplib.${subsetname}; + functions = libDefPos [] toplib.${subsetname}; }) (builtins.map (x: x.name) libsets); |