2023-02-02 18:25:31 +00:00
|
|
|
{ lib
|
|
|
|
, python3
|
2023-02-09 11:40:11 +00:00
|
|
|
, runCommand
|
2023-02-02 18:25:31 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-01-13 08:15:51 +00:00
|
|
|
python = python3.override {
|
2024-09-19 14:19:46 +00:00
|
|
|
self = python;
|
2023-03-15 16:39:30 +00:00
|
|
|
packageOverrides = final: prev: {
|
|
|
|
markdown-it-py = prev.markdown-it-py.overridePythonAttrs (_: {
|
|
|
|
doCheck = false;
|
|
|
|
});
|
|
|
|
mdit-py-plugins = prev.mdit-py-plugins.overridePythonAttrs (_: {
|
|
|
|
doCheck = false;
|
|
|
|
});
|
|
|
|
};
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
python.pkgs.buildPythonApplication rec {
|
2023-02-02 18:25:31 +00:00
|
|
|
pname = "nixos-render-docs";
|
|
|
|
version = "0.0";
|
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
src = lib.cleanSourceWith {
|
|
|
|
filter = name: type:
|
|
|
|
lib.cleanSourceFilter name type
|
|
|
|
&& ! (type == "directory"
|
|
|
|
&& builtins.elem
|
|
|
|
(baseNameOf name)
|
|
|
|
[
|
|
|
|
".pytest_cache"
|
|
|
|
".mypy_cache"
|
|
|
|
"__pycache__"
|
|
|
|
]);
|
|
|
|
src = ./src;
|
|
|
|
};
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
nativeBuildInputs = with python.pkgs; [
|
|
|
|
setuptools
|
|
|
|
pytestCheckHook
|
2023-02-02 18:25:31 +00:00
|
|
|
];
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
propagatedBuildInputs = with python.pkgs; [
|
|
|
|
markdown-it-py
|
|
|
|
mdit-py-plugins
|
|
|
|
];
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
pytestFlagsArray = [ "-vvrP" "tests/" ];
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
# 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 = [
|
2023-03-15 16:39:30 +00:00
|
|
|
(python3.withPackages (ps: with ps; [ mypy pytest markdown-it-py mdit-py-plugins ]))
|
2023-02-09 11:40:11 +00:00
|
|
|
];
|
|
|
|
} ''
|
|
|
|
mypy --strict ${src}
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Renderer for NixOS manual and option docs";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "nixos-render-docs";
|
2023-02-02 18:25:31 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ ];
|
|
|
|
};
|
|
|
|
}
|