lol

nixos-render-docs: add a test for running mypy

pulling mypy into the build closure is unfortunately not reasonable, the
closure for mypy is rather large and takes a long time to build. if we
have the type checks hooked into CI we'll get most of the benefit though.

authored by

pennae and committed by
pennae
edccae73 62b965c1

+28 -6
+28 -6
pkgs/tools/nix/nixos-render-docs/default.nix
··· 2 2 , stdenv 3 3 , python3 4 4 , python3Minimal 5 + , runCommand 5 6 }: 6 7 7 8 let ··· 21 22 markdown-it-py = markdown-it-py-no-tests; 22 23 disableTests = true; 23 24 }; 25 + 26 + makeDeps = pkgs: small: 27 + [ pkgs.frozendict ] 28 + ++ ( 29 + if small 30 + then [ 31 + markdown-it-py-no-tests 32 + mdit-py-plugins-no-tests 33 + ] 34 + else [ 35 + pkgs.markdown-it-py 36 + pkgs.mdit-py-plugins 37 + ] 38 + ); 24 39 in 25 40 26 - python.pkgs.buildPythonApplication { 41 + python.pkgs.buildPythonApplication rec { 27 42 pname = "nixos-render-docs"; 28 43 version = "0.0"; 29 44 format = "pyproject"; ··· 47 62 python.pkgs.pytestCheckHook 48 63 ]; 49 64 50 - propagatedBuildInputs = [ 51 - markdown-it-py-no-tests 52 - mdit-py-plugins-no-tests 53 - python.pkgs.frozendict 54 - ]; 65 + propagatedBuildInputs = makeDeps python.pkgs true; 55 66 56 67 pytestFlagsArray = [ "-vvrP" "tests/" ]; 68 + 69 + # NOTE this is a CI test rather than a build-time test because we want to keep the 70 + # build closures small. mypy has an unreasonably large build closure for docs builds. 71 + passthru.tests.typing = runCommand "${pname}-mypy" { 72 + nativeBuildInputs = [ 73 + (python3.withPackages (p: [ p.mypy p.pytest ] ++ makeDeps p false)) 74 + ]; 75 + } '' 76 + mypy --strict ${src} 77 + touch $out 78 + ''; 57 79 58 80 meta = with lib; { 59 81 description = "Renderer for NixOS manual and option docs";