forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.nix
68 lines (60 loc) · 1.57 KB
/
package.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ lib
, python3
, runCommand
}:
let
python = python3.override {
self = python;
packageOverrides = final: prev: {
markdown-it-py = prev.markdown-it-py.overridePythonAttrs (_: {
doCheck = false;
});
mdit-py-plugins = prev.mdit-py-plugins.overridePythonAttrs (_: {
doCheck = false;
});
};
};
in
python.pkgs.buildPythonApplication rec {
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;
};
nativeBuildInputs = with python.pkgs; [
setuptools
pytestCheckHook
];
propagatedBuildInputs = with python.pkgs; [
markdown-it-py
mdit-py-plugins
];
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 (ps: with ps; [ mypy pytest markdown-it-py mdit-py-plugins ]))
];
} ''
mypy --strict ${src}
touch $out
'';
meta = with lib; {
description = "Renderer for NixOS manual and option docs";
mainProgram = "nixos-render-docs";
license = licenses.mit;
maintainers = [ ];
};
}