about summary refs log tree commit diff
path: root/pkgs/applications/virtualization/virt-viewer/default.nix
blob: b0bf423605f37da05c5309a6b0392d75f698e46e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{ lib
, stdenv
, bash-completion
, fetchurl
, fetchpatch
, gdbm
, glib
, gst_all_1
, gsettings-desktop-schemas
, gtk-vnc
, gtk3
, intltool
, libcap
, libgovirt
  # Currently unsupported. According to upstream, libgovirt is for a very narrow
  # use-case and we don't currently cover it in Nixpkgs. It's safe to disable.
  # https://gitlab.com/virt-viewer/virt-viewer/-/issues/100#note_1265011223
  # Can be enabled again once this is merged:
  # https://gitlab.com/virt-viewer/virt-viewer/-/merge_requests/129
, ovirtSupport ? false
, libvirt
, libvirt-glib
, libxml2
, meson
, ninja
, pkg-config
, python3
, shared-mime-info
, spice-gtk
, spice-protocol
, spiceSupport ? true
, vte
, wrapGAppsHook3
}:

with lib;

stdenv.mkDerivation rec {
  pname = "virt-viewer";
  version = "11.0";

  src = fetchurl {
    url = "https://releases.pagure.org/virt-viewer/virt-viewer-${version}.tar.xz";
    sha256 = "sha256-pD+iMlxMHHelyMmAZaww7wURohrJjlkPIjQIabrZq9A=";
  };

  patches = [
    # Fix build with meson 0.61. Should be fixed in the next release.
    # https://gitlab.com/virt-viewer/virt-viewer/-/merge_requests/120
    (fetchpatch {
      url = "https://gitlab.com/virt-viewer/virt-viewer/-/commit/98d9f202ef768f22ae21b5c43a080a1aa64a7107.patch";
      sha256 = "sha256-3AbnkbhWOh0aNjUkmVoSV/9jFQtvTllOr7plnkntb2o=";
    })
  ];

  nativeBuildInputs = [
    glib
    intltool
    meson
    ninja
    pkg-config
    python3
    shared-mime-info
    wrapGAppsHook3
  ];

  buildInputs = [
    gst_all_1.gst-plugins-base
    gst_all_1.gst-plugins-good
    bash-completion
    glib
    gsettings-desktop-schemas
    gtk-vnc
    gtk3
    libvirt
    libvirt-glib
    libxml2
    vte
  ] ++ optionals ovirtSupport [
    libgovirt
  ] ++ optionals spiceSupport ([
    gdbm
    spice-gtk
    spice-protocol
  ] ++ optionals stdenv.isLinux [
    libcap
  ]);

  # Required for USB redirection PolicyKit rules file
  propagatedUserEnvPkgs = optional spiceSupport spice-gtk;

  mesonFlags = [
    (lib.mesonEnable "ovirt" ovirtSupport)
  ];

  strictDeps = true;

  postPatch = ''
    patchShebangs build-aux/post_install.py
  '';

  meta = {
    description = "A viewer for remote virtual machines";
    maintainers = with maintainers; [ raskin atemu ];
    platforms = with platforms; linux ++ darwin;
    license = licenses.gpl2;
  };
  passthru = {
    updateInfo = {
      downloadPage = "https://virt-manager.org/download.html";
    };
  };
}