nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 bash-completion,
5 fetchurl,
6 fetchpatch,
7 gdbm,
8 glib,
9 gst_all_1,
10 gsettings-desktop-schemas,
11 gtk-vnc,
12 gtk3,
13 intltool,
14 libcap,
15 libgovirt,
16 # Currently unsupported. According to upstream, libgovirt is for a very narrow
17 # use-case and we don't currently cover it in Nixpkgs. It's safe to disable.
18 # https://gitlab.com/virt-viewer/virt-viewer/-/issues/100#note_1265011223
19 # Can be enabled again once this is merged:
20 # https://gitlab.com/virt-viewer/virt-viewer/-/merge_requests/129
21 ovirtSupport ? false,
22 libvirt,
23 libvirt-glib,
24 libxml2,
25 meson,
26 ninja,
27 pkg-config,
28 python3,
29 shared-mime-info,
30 spice-gtk,
31 spice-protocol,
32 spiceSupport ? true,
33 vte,
34 wrapGAppsHook3,
35}:
36stdenv.mkDerivation rec {
37 pname = "virt-viewer";
38 version = "11.0";
39
40 src = fetchurl {
41 url = "https://releases.pagure.org/virt-viewer/virt-viewer-${version}.tar.xz";
42 sha256 = "sha256-pD+iMlxMHHelyMmAZaww7wURohrJjlkPIjQIabrZq9A=";
43 };
44
45 patches = [
46 # Fix build with meson 0.61. Should be fixed in the next release.
47 # https://gitlab.com/virt-viewer/virt-viewer/-/merge_requests/120
48 (fetchpatch {
49 url = "https://gitlab.com/virt-viewer/virt-viewer/-/commit/98d9f202ef768f22ae21b5c43a080a1aa64a7107.patch";
50 sha256 = "sha256-3AbnkbhWOh0aNjUkmVoSV/9jFQtvTllOr7plnkntb2o=";
51 })
52 ];
53
54 nativeBuildInputs = [
55 glib
56 intltool
57 meson
58 ninja
59 pkg-config
60 python3
61 shared-mime-info
62 wrapGAppsHook3
63 ];
64
65 buildInputs = [
66 gst_all_1.gst-plugins-base
67 gst_all_1.gst-plugins-good
68 bash-completion
69 glib
70 gsettings-desktop-schemas
71 gtk-vnc
72 gtk3
73 libvirt
74 libvirt-glib
75 libxml2
76 vte
77 ]
78 ++ lib.optionals ovirtSupport [
79 libgovirt
80 ]
81 ++ lib.optionals spiceSupport (
82 [
83 gdbm
84 spice-gtk
85 spice-protocol
86 ]
87 ++ lib.optionals stdenv.hostPlatform.isLinux [
88 libcap
89 ]
90 );
91
92 # Required for USB redirection PolicyKit rules file
93 propagatedUserEnvPkgs = lib.optional spiceSupport spice-gtk;
94
95 mesonFlags = [
96 (lib.mesonEnable "ovirt" ovirtSupport)
97 ];
98
99 strictDeps = true;
100
101 postPatch = ''
102 patchShebangs build-aux/post_install.py
103 '';
104
105 meta = with lib; {
106 description = "Viewer for remote virtual machines";
107 maintainers = with maintainers; [
108 raskin
109 atemu
110 ];
111 platforms = with platforms; linux ++ darwin;
112 license = licenses.gpl2;
113 mainProgram = "virt-viewer";
114 };
115 passthru = {
116 updateInfo = {
117 downloadPage = "https://virt-manager.org/download.html";
118 };
119 };
120}