1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 qemu,
6 setuptools,
7 fuseSupport ? false,
8 fusepy,
9 tuiSupport ? false,
10 urwid,
11 urwid-readline,
12 pygments,
13}:
14
15buildPythonPackage {
16 pname = "qemu";
17 version = "0.6.1.0a1";
18 pyproject = true;
19
20 disabled = pythonOlder "3.6";
21
22 src = qemu.src;
23
24 prePatch = ''
25 cd python
26 '';
27
28 # ensure the version matches qemu-xxx/python/VERSION
29 preConfigure = ''
30 if [ "$version" != "$(cat ./VERSION)" ]; then
31 echo "The nix package version attribute is not in sync with the QEMU source version" > /dev/stderr
32 echo "Please update the version attribute in the nix expression of python3Packages.qemu to '$version'" > /dev/stderr
33 exit 1
34 fi
35 '';
36
37 buildInputs = [ setuptools ];
38
39 propagatedBuildInputs =
40 [ ]
41 ++ lib.optionals fuseSupport [ fusepy ]
42 ++ lib.optionals tuiSupport [
43 urwid
44 urwid-readline
45 pygments
46 ];
47
48 # Project requires avocado-framework for testing, therefore replacing check phase
49 checkPhase = ''
50 for bin in $out/bin/*; do
51 $bin --help
52 done
53 '';
54
55 pythonImportsCheck = [ "qemu" ];
56
57 preFixup =
58 (lib.optionalString (!tuiSupport) ''
59 rm $out/bin/qmp-tui
60 '')
61 + (lib.optionalString (!fuseSupport) ''
62 rm $out/bin/qom-fuse
63 '');
64
65 meta = with lib; {
66 homepage = "https://www.qemu.org/";
67 description = "Python tooling used by the QEMU project to build, configure, and test QEMU";
68 license = licenses.gpl2Plus;
69 maintainers = with maintainers; [
70 devplayer0
71 davhau
72 ];
73 };
74}