10 gobject-introspection,
41 withPolkit ? stdenv.hostPlatform.isLinux,
44 # If this package is built with polkit support (withPolkit=true),
45 # usb redirection requires spice-client-glib-usb-acl-helper to run setuid root.
46 # The helper confirms via polkit that the user has an active session,
47 # then adds a device acl entry for that user.
48 # Example NixOS config to create a setuid wrapper for the helper:
49 # security.wrappers.spice-client-glib-usb-acl-helper.source =
50 # "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper";
51 # On non-NixOS installations, make a setuid copy of the helper
52 # outside the store and adjust PATH to find the setuid version.
54 # If this package is built without polkit support (withPolkit=false),
55 # usb redirection requires read-write access to usb devices.
56 # This can be granted by adding users to a custom group like "usb"
57 # and using a udev rule to put all usb devices in that group.
58 # Example NixOS config:
59 # users.groups.usb = {};
60 # users.users.dummy.extraGroups = [ "usb" ];
61 # services.udev.extraRules = ''
62 # KERNEL=="*", SUBSYSTEMS=="usb", MODE="0664", GROUP="usb"
65 stdenv.mkDerivation rec {
77 url = "https://www.spice-space.org/download/gtk/${pname}-${version}.tar.xz";
78 sha256 = "sha256-k4ARfxgRrR+qGBLLZgJHm2KQ1KDYzEQtREJ/f2wOelg=";
96 python3.pkgs.pyparsing
101 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
104 ++ lib.optionals stdenv.hostPlatform.isLinux [
110 gst_all_1.gst-plugins-base
111 gst_all_1.gst-plugins-good
130 ++ lib.optionals withPolkit [
134 ++ lib.optionals stdenv.hostPlatform.isLinux [
140 PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions";
144 "-Dusb-acl-helper-dir=${placeholder "out"}/bin"
145 "-Dusb-ids-path=${hwdata}/share/hwdata/usb.ids"
147 ++ lib.optionals (!withPolkit) [
150 ++ lib.optionals (!stdenv.hostPlatform.isLinux) [
151 "-Dlibcap-ng=disabled"
154 ++ lib.optionals stdenv.hostPlatform.isMusl [
155 "-Dcoroutine=gthread" # Fixes "Function missing:makecontext"
160 # get rid of absolute path to helper in store so we can use a setuid wrapper
161 substituteInPlace src/usb-acl-helper.c \
162 --replace-fail 'ACL_HELPER_PATH"/' '"'
163 # don't try to setcap/suid in a nix builder
164 substituteInPlace src/meson.build \
165 --replace-fail "meson.add_install_script('../build-aux/setcap-or-suid'," \
166 "# meson.add_install_script('../build-aux/setcap-or-suid',"
168 patchShebangs subprojects/keycodemapdb/tools/keymap-gen
170 + lib.optionalString stdenv.hostPlatform.isDarwin ''
171 # don't use version script and don't export symbols
172 substituteInPlace src/meson.build \
173 --replace-fail "spice_gtk_version_script = [" "# spice_gtk_version_script = [" \
174 --replace-fail ",--version-script=@0@'.format(spice_client_glib_syms_path)" "'"
178 description = "GTK 3 SPICE widget";
180 spice-gtk is a GTK 3 SPICE widget. It features glib-based
181 objects for SPICE protocol parsing and a gtk widget for embedding
182 the SPICE display into other applications such as virt-manager.
183 Python bindings are available too.
186 homepage = "https://www.spice-space.org/";
187 license = licenses.lgpl21;
188 maintainers = [ maintainers.xeji ];
189 platforms = platforms.unix;