biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / applications / virtualization / virt-manager / default.nix
blob8546f64a55b041ba1305e1662b1ae877c6fb0ca1
1 { lib, fetchFromGitHub, python3, intltool, file, wrapGAppsHook3, gtk-vnc
2 , vte, avahi, dconf, gobject-introspection, libvirt-glib, system-libvirt
3 , gsettings-desktop-schemas, gst_all_1, libosinfo, adwaita-icon-theme, gtksourceview4, docutils, cpio
4 , e2fsprogs, findutils, gzip, cdrtools, xorriso, fetchpatch
5 , desktopToDarwinBundle, stdenv
6 , spiceSupport ? true, spice-gtk ? null
7 }:
9 python3.pkgs.buildPythonApplication rec {
10   pname = "virt-manager";
11   version = "4.1.0";
13   src = fetchFromGitHub {
14     owner = pname;
15     repo = pname;
16     rev = "v${version}";
17     hash = "sha256-UgZ58WLXq0U3EDt4311kv0kayVU17In4kwnQ+QN1E7A=";
18   };
20   patches = [
21     # refresh Fedora tree URLs in virt-install-osinfo* expected XMLs
22     (fetchpatch {
23       url = "https://github.com/virt-manager/virt-manager/commit/6e5c1db6b4a0af96afeb09a09fb2fc2b73308f01.patch";
24       hash = "sha256-zivVo6nHvfB7aHadOouQZCBXn5rY12nxFjQ4FFwjgZI=";
25     })
26     # fix test with libvirt 10
27     (fetchpatch {
28       url = "https://github.com/virt-manager/virt-manager/commit/83fcc5b2e8f2cede84564387756fe8971de72188.patch";
29       hash = "sha256-yEk+md5EkwYpP27u3E+oTJ8thgtH2Uy1x3JIWPBhqeE=";
30     })
31     # fix crash with some cursor themes
32     (fetchpatch {
33       url = "https://github.com/virt-manager/virt-manager/commit/cc4a39ea94f42bc92765eb3bb56e2b7f9198be67.patch";
34       hash = "sha256-dw6yrMaAOnTh8Z6xJQQKmYelOkOl6EBAOfJQU9vQ8Ws=";
35     })
36     # fix xml test output mismatch
37     (fetchpatch {
38       url = "https://github.com/virt-manager/virt-manager/commit/8b6db203f726965529567459b302aab1c68c70eb.patch";
39       hash = "sha256-FghrSyP4NaTkJhvyqlc2uDNWKaeiylKnaiqkl5Ax6yE=";
40     })
41   ];
43   nativeBuildInputs = [
44     intltool file
45     gobject-introspection # for setup hook populating GI_TYPELIB_PATH
46     docutils
47     wrapGAppsHook3
48   ] ++ lib.optional stdenv.hostPlatform.isDarwin desktopToDarwinBundle;
50   buildInputs = [
51     gst_all_1.gst-plugins-base
52     gst_all_1.gst-plugins-good
53     libvirt-glib vte dconf gtk-vnc adwaita-icon-theme avahi
54     gsettings-desktop-schemas libosinfo gtksourceview4
55   ] ++ lib.optional spiceSupport spice-gtk;
57   dependencies = with python3.pkgs; [
58     pygobject3 libvirt libxml2 requests cdrtools
59   ];
61   postPatch = ''
62     sed -i 's|/usr/share/libvirt/cpu_map.xml|${system-libvirt}/share/libvirt/cpu_map.xml|g' virtinst/capabilities.py
63     sed -i "/'install_egg_info'/d" setup.py
64   '';
66   postConfigure = ''
67     ${python3.interpreter} setup.py configure --prefix=$out
68   '';
70   setupPyGlobalFlags = [ "--no-update-icon-cache" "--no-compile-schemas" ];
72   dontWrapGApps = true;
74   preFixup = ''
75     glib-compile-schemas $out/share/gsettings-schemas/${pname}-${version}/glib-2.0/schemas
77     gappsWrapperArgs+=(--set PYTHONPATH "${python3.pkgs.makePythonPath dependencies}")
78     # these are called from virt-install in initrdinject.py
79     gappsWrapperArgs+=(--prefix PATH : "${lib.makeBinPath [ cpio e2fsprogs file findutils gzip ]}")
81     makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
83     # Fixes testCLI0051virt_install_initrd_inject on Darwin: "cpio: root:root: invalid group"
84     substituteInPlace virtinst/install/installerinject.py \
85       --replace "'--owner=root:root'" "'--owner=0:0'"
86   '';
88   nativeCheckInputs = with python3.pkgs; [
89     pytest7CheckHook
90     cpio
91     cdrtools
92     xorriso
93   ];
95   disabledTests = [
96     "testAlterDisk"
97     "test_misc_nonpredicatble_generate"
98     "test_disk_dir_searchable"  # does something strange with permissions
99     "testCLI0001virt_install_many_devices"  # expects /var to exist
100   ];
102   preCheck = ''
103     export HOME=$(mktemp -d)
104   ''; # <- Required for "tests/test_urldetect.py".
106   postCheck = ''
107     $out/bin/virt-manager --version | grep -Fw ${version} > /dev/null
108   '';
110   meta = with lib; {
111     homepage = "https://virt-manager.org";
112     description = "Desktop user interface for managing virtual machines";
113     longDescription = ''
114       The virt-manager application is a desktop user interface for managing
115       virtual machines through libvirt. It primarily targets KVM VMs, but also
116       manages Xen and LXC (linux containers).
117     '';
118     license = licenses.gpl2;
119     platforms = platforms.unix;
120     mainProgram = "virt-manager";
121     maintainers = with maintainers; [ qknight offline fpletz globin ];
122   };