nixpkgs/pkgs/by-name/ni/nixos-render-docs/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

69 lines
1.6 KiB
Nix

{ 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 = [ ];
};
}