about summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-01-03 18:01:45 +0000
committerGitHub <noreply@github.com>2023-01-03 18:01:45 +0000
commite076f677a18367bc763df319bba01e51ba8ff681 (patch)
tree11fc8ca1f307f9691d788fb561de2bc0a3c8ae9a /doc
parente2839320bbd82060bcb040d543d96c2b2d70d0c5 (diff)
parent87b071289022b10288f595c6286c9692449698fd (diff)
downloadnixlib-e076f677a18367bc763df319bba01e51ba8ff681.tar
nixlib-e076f677a18367bc763df319bba01e51ba8ff681.tar.gz
nixlib-e076f677a18367bc763df319bba01e51ba8ff681.tar.bz2
nixlib-e076f677a18367bc763df319bba01e51ba8ff681.tar.lz
nixlib-e076f677a18367bc763df319bba01e51ba8ff681.tar.xz
nixlib-e076f677a18367bc763df319bba01e51ba8ff681.tar.zst
nixlib-e076f677a18367bc763df319bba01e51ba8ff681.zip
Merge staging-next into staging
Diffstat (limited to 'doc')
-rw-r--r--doc/doc-support/default.nix1
-rw-r--r--doc/doc-support/lib-function-docs.nix6
-rw-r--r--doc/doc-support/lib-function-locations.nix16
-rw-r--r--doc/languages-frameworks/python.section.md16
4 files changed, 30 insertions, 9 deletions
diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix
index ec180064c35d..e9cb96e37fdd 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 d6fa08aa9620..cf218fa70401 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 ae1123c63ad3..3ede09ba50f5 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);
 
diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md
index ab5ba4289585..2f15d0f0468a 100644
--- a/doc/languages-frameworks/python.section.md
+++ b/doc/languages-frameworks/python.section.md
@@ -570,7 +570,13 @@ test run would be:
 
 ```
   checkInputs = [ pytest ];
-  checkPhase = "pytest";
+  checkPhase = ''
+    runHook preCheck
+
+    pytest
+
+    runHook postCheck
+  '';
 ```
 
 However, many repositories' test suites do not translate well to nix's build
@@ -582,7 +588,11 @@ To filter tests using pytest, one can do the following:
   checkInputs = [ pytest ];
   # avoid tests which need additional data or touch network
   checkPhase = ''
+    runHook preCheck
+
     pytest tests/ --ignore=tests/integration -k 'not download and not update'
+
+    runHook postCheck
   '';
 ```
 
@@ -1408,7 +1418,11 @@ example of such a situation is when `py.test` is used.
     # assumes the tests are located in tests
     checkInputs = [ pytest ];
     checkPhase = ''
+      runHook preCheck
+
       py.test -k 'not function_name and not other_function' tests
+
+      runHook postCheck
     '';
   }
   ```