about summary refs log tree commit diff
path: root/pkgs/tools/nix/nixos-render-docs/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/nix/nixos-render-docs/default.nix')
-rw-r--r--pkgs/tools/nix/nixos-render-docs/default.nix34
1 files changed, 28 insertions, 6 deletions
diff --git a/pkgs/tools/nix/nixos-render-docs/default.nix b/pkgs/tools/nix/nixos-render-docs/default.nix
index 55bbbd9ffa561..312bc80582453 100644
--- a/pkgs/tools/nix/nixos-render-docs/default.nix
+++ b/pkgs/tools/nix/nixos-render-docs/default.nix
@@ -2,6 +2,7 @@
 , stdenv
 , python3
 , python3Minimal
+, runCommand
 }:
 
 let
@@ -21,9 +22,23 @@ let
     markdown-it-py = markdown-it-py-no-tests;
     disableTests = true;
   };
+
+  makeDeps = pkgs: small:
+    [ pkgs.frozendict ]
+    ++ (
+      if small
+      then [
+        markdown-it-py-no-tests
+        mdit-py-plugins-no-tests
+      ]
+      else [
+        pkgs.markdown-it-py
+        pkgs.mdit-py-plugins
+      ]
+    );
 in
 
-python.pkgs.buildPythonApplication {
+python.pkgs.buildPythonApplication rec {
   pname = "nixos-render-docs";
   version = "0.0";
   format = "pyproject";
@@ -47,14 +62,21 @@ python.pkgs.buildPythonApplication {
     python.pkgs.pytestCheckHook
   ];
 
-  propagatedBuildInputs = [
-    markdown-it-py-no-tests
-    mdit-py-plugins-no-tests
-    python.pkgs.frozendict
-  ];
+  propagatedBuildInputs = makeDeps python.pkgs true;
 
   pytestFlagsArray = [ "-vvrP" "tests/" ];
 
+  # NOTE this is a CI test rather than a build-time test because we want to keep the
+  # build closures small. mypy has an unreasonably large build closure for docs builds.
+  passthru.tests.typing = runCommand "${pname}-mypy" {
+    nativeBuildInputs = [
+      (python3.withPackages (p: [ p.mypy p.pytest ] ++ makeDeps p false))
+    ];
+  } ''
+    mypy --strict ${src}
+    touch $out
+  '';
+
   meta = with lib; {
     description = "Renderer for NixOS manual and option docs";
     license = licenses.mit;