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