1{
2 lib,
3 python3Packages,
4 enableOCR ? false,
5 qemu_pkg ? qemu_test,
6 coreutils,
7 imagemagick_light,
8 netpbm,
9 qemu_test,
10 socat,
11 ruff,
12 tesseract4,
13 vde2,
14 extraPythonPackages ? (_: [ ]),
15 nixosTests,
16}:
17python3Packages.buildPythonApplication {
18 pname = "nixos-test-driver";
19 version = "1.1";
20 pyproject = true;
21
22 src = ./src;
23
24 build-system = with python3Packages; [
25 setuptools
26 ];
27
28 dependencies =
29 with python3Packages;
30 [
31 colorama
32 junit-xml
33 ptpython
34 ipython
35 ]
36 ++ extraPythonPackages python3Packages;
37
38 propagatedBuildInputs =
39 [
40 coreutils
41 netpbm
42 qemu_pkg
43 socat
44 vde2
45 ]
46 ++ lib.optionals enableOCR [
47 imagemagick_light
48 tesseract4
49 ];
50
51 passthru.tests = {
52 inherit (nixosTests.nixos-test-driver) driver-timeout;
53 };
54
55 doCheck = true;
56
57 nativeCheckInputs = with python3Packages; [
58 mypy
59 ruff
60 ];
61
62 checkPhase = ''
63 echo -e "\x1b[32m## run mypy\x1b[0m"
64 mypy test_driver extract-docstrings.py
65 echo -e "\x1b[32m## run ruff check\x1b[0m"
66 ruff check .
67 echo -e "\x1b[32m## run ruff format\x1b[0m"
68 ruff format --check --diff .
69 '';
70}