9 , gobject-introspection
20 , withLibsoup2 ? false
40 , withPolkit ? stdenv.isLinux
43 # If this package is built with polkit support (withPolkit=true),
44 # usb redirection reqires spice-client-glib-usb-acl-helper to run setuid root.
45 # The helper confirms via polkit that the user has an active session,
46 # then adds a device acl entry for that user.
47 # Example NixOS config to create a setuid wrapper for the helper:
48 # security.wrappers.spice-client-glib-usb-acl-helper.source =
49 # "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper";
50 # On non-NixOS installations, make a setuid copy of the helper
51 # outside the store and adjust PATH to find the setuid version.
53 # If this package is built without polkit support (withPolkit=false),
54 # usb redirection requires read-write access to usb devices.
55 # This can be granted by adding users to a custom group like "usb"
56 # and using a udev rule to put all usb devices in that group.
57 # Example NixOS config:
58 # users.groups.usb = {};
59 # users.users.dummy.extraGroups = [ "usb" ];
60 # services.udev.extraRules = ''
61 # KERNEL=="*", SUBSYSTEMS=="usb", MODE="0664", GROUP="usb"
64 stdenv.mkDerivation rec {
68 outputs = [ "out" "dev" "devdoc" "man" ];
71 url = "https://www.spice-space.org/download/gtk/${pname}-${version}.tar.xz";
72 sha256 = "sha256-2Pi1y+qRhHAu64zCdqZ9cqzbbjbnxzNJ+4RF5byglp8=";
76 # get rid of absolute path to helper in store so we can use a setuid wrapper
77 substituteInPlace src/usb-acl-helper.c \
78 --replace 'ACL_HELPER_PATH"/' '"'
79 # don't try to setcap/suid in a nix builder
80 substituteInPlace src/meson.build \
81 --replace "meson.add_install_script('../build-aux/setcap-or-suid'," \
82 "# meson.add_install_script('../build-aux/setcap-or-suid',"
95 python3.pkgs.pyparsing
100 propagatedBuildInputs = [
101 gst_all_1.gst-plugins-base
102 gst_all_1.gst-plugins-good
113 (if withLibsoup2 then libsoup else libsoup_3)
117 (if withLibsoup2 then phodav_2_0 else phodav)
122 ] ++ lib.optionals withPolkit [
125 ] ++ lib.optionals stdenv.isLinux [
131 PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions";
134 "-Dusb-acl-helper-dir=${placeholder "out"}/bin"
135 "-Dusb-ids-path=${hwdata}/share/hwdata/usb.ids"
136 ] ++ lib.optionals (!withPolkit) [
138 ] ++ lib.optionals (!stdenv.isLinux) [
139 "-Dlibcap-ng=disabled"
143 description = "GTK 3 SPICE widget";
145 spice-gtk is a GTK 3 SPICE widget. It features glib-based
146 objects for SPICE protocol parsing and a gtk widget for embedding
147 the SPICE display into other applications such as virt-manager.
148 Python bindings are available too.
151 homepage = "https://www.spice-space.org/";
152 license = licenses.lgpl21;
153 maintainers = [ maintainers.xeji ];
154 platforms = platforms.unix;