2022-08-12 12:06:08 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
|
|
|
, acl
|
2020-05-03 17:38:23 +00:00
|
|
|
, cyrus_sasl
|
|
|
|
, docbook_xsl
|
2021-12-06 16:07:01 +00:00
|
|
|
, libepoxy
|
2020-05-03 17:38:23 +00:00
|
|
|
, gettext
|
|
|
|
, gobject-introspection
|
2020-04-24 23:36:52 +00:00
|
|
|
, gst_all_1
|
|
|
|
, gtk-doc
|
2020-05-03 17:38:23 +00:00
|
|
|
, gtk3
|
2022-02-20 05:27:41 +00:00
|
|
|
, hwdata
|
2020-04-24 23:36:52 +00:00
|
|
|
, json-glib
|
|
|
|
, libcacard
|
2022-02-20 05:27:41 +00:00
|
|
|
, libcap_ng
|
2020-05-03 17:38:23 +00:00
|
|
|
, libdrm
|
|
|
|
, libjpeg_turbo
|
|
|
|
, libopus
|
2022-10-21 18:38:19 +00:00
|
|
|
, libsoup_3
|
2020-05-03 17:38:23 +00:00
|
|
|
, libusb1
|
|
|
|
, lz4
|
|
|
|
, meson
|
2022-12-17 10:02:37 +00:00
|
|
|
, mesonEmulatorHook
|
2020-05-03 17:38:23 +00:00
|
|
|
, ninja
|
|
|
|
, openssl
|
2020-04-24 23:36:52 +00:00
|
|
|
, perl
|
2020-05-03 17:38:23 +00:00
|
|
|
, phodav
|
|
|
|
, pixman
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-05-03 17:38:23 +00:00
|
|
|
, polkit
|
|
|
|
, python3
|
|
|
|
, spice-protocol
|
|
|
|
, usbredir
|
|
|
|
, vala
|
2022-02-20 05:27:41 +00:00
|
|
|
, wayland-protocols
|
2022-12-17 10:02:37 +00:00
|
|
|
, wayland-scanner
|
2020-05-03 17:38:23 +00:00
|
|
|
, zlib
|
2022-08-12 12:06:08 +00:00
|
|
|
, withPolkit ? stdenv.isLinux
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
# If this package is built with polkit support (withPolkit=true),
|
|
|
|
# usb redirection reqires spice-client-glib-usb-acl-helper to run setuid root.
|
|
|
|
# The helper confirms via polkit that the user has an active session,
|
|
|
|
# then adds a device acl entry for that user.
|
|
|
|
# Example NixOS config to create a setuid wrapper for the helper:
|
|
|
|
# security.wrappers.spice-client-glib-usb-acl-helper.source =
|
|
|
|
# "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper";
|
|
|
|
# On non-NixOS installations, make a setuid copy of the helper
|
|
|
|
# outside the store and adjust PATH to find the setuid version.
|
|
|
|
|
|
|
|
# If this package is built without polkit support (withPolkit=false),
|
|
|
|
# usb redirection requires read-write access to usb devices.
|
|
|
|
# This can be granted by adding users to a custom group like "usb"
|
|
|
|
# and using a udev rule to put all usb devices in that group.
|
|
|
|
# Example NixOS config:
|
|
|
|
# users.groups.usb = {};
|
|
|
|
# users.users.dummy.extraGroups = [ "usb" ];
|
|
|
|
# services.udev.extraRules = ''
|
|
|
|
# KERNEL=="*", SUBSYSTEMS=="usb", MODE="0664", GROUP="usb"
|
|
|
|
# '';
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "spice-gtk";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "0.41";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" "devdoc" "man" ];
|
|
|
|
|
|
|
|
src = fetchurl {
|
2022-02-20 05:27:41 +00:00
|
|
|
url = "https://www.spice-space.org/download/gtk/${pname}-${version}.tar.xz";
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-2Pi1y+qRhHAu64zCdqZ9cqzbbjbnxzNJ+4RF5byglp8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# get rid of absolute path to helper in store so we can use a setuid wrapper
|
|
|
|
substituteInPlace src/usb-acl-helper.c \
|
|
|
|
--replace 'ACL_HELPER_PATH"/' '"'
|
2022-02-20 05:27:41 +00:00
|
|
|
# don't try to setcap/suid in a nix builder
|
|
|
|
substituteInPlace src/meson.build \
|
|
|
|
--replace "meson.add_install_script('../build-aux/setcap-or-suid'," \
|
|
|
|
"# meson.add_install_script('../build-aux/setcap-or-suid',"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
depsBuildBuild = [
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
docbook_xsl
|
|
|
|
gettext
|
|
|
|
gobject-introspection
|
|
|
|
gtk-doc
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
perl
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
python3
|
|
|
|
python3.pkgs.pyparsing
|
|
|
|
python3.pkgs.six
|
|
|
|
vala
|
2022-12-17 10:02:37 +00:00
|
|
|
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
|
|
|
mesonEmulatorHook
|
2022-12-28 21:21:41 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
wayland-scanner
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2022-08-12 12:06:08 +00:00
|
|
|
gst_all_1.gst-plugins-base
|
|
|
|
gst_all_1.gst-plugins-good
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
cyrus_sasl
|
2021-12-06 16:07:01 +00:00
|
|
|
libepoxy
|
2020-04-24 23:36:52 +00:00
|
|
|
gtk3
|
|
|
|
json-glib
|
|
|
|
libcacard
|
|
|
|
libjpeg_turbo
|
2020-05-03 17:38:23 +00:00
|
|
|
libopus
|
2023-03-04 12:14:45 +00:00
|
|
|
libsoup_3
|
2020-05-03 17:38:23 +00:00
|
|
|
libusb1
|
2020-04-24 23:36:52 +00:00
|
|
|
lz4
|
|
|
|
openssl
|
2023-03-04 12:14:45 +00:00
|
|
|
phodav
|
2020-04-24 23:36:52 +00:00
|
|
|
pixman
|
|
|
|
spice-protocol
|
|
|
|
usbredir
|
2022-12-17 10:02:37 +00:00
|
|
|
vala
|
2020-04-24 23:36:52 +00:00
|
|
|
zlib
|
2022-08-12 12:06:08 +00:00
|
|
|
] ++ lib.optionals withPolkit [
|
|
|
|
polkit
|
|
|
|
acl
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
libcap_ng
|
|
|
|
libdrm
|
|
|
|
wayland-protocols
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions";
|
|
|
|
|
|
|
|
mesonFlags = [
|
2022-02-20 05:27:41 +00:00
|
|
|
"-Dusb-acl-helper-dir=${placeholder "out"}/bin"
|
|
|
|
"-Dusb-ids-path=${hwdata}/share/hwdata/usb.ids"
|
2022-03-05 16:20:37 +00:00
|
|
|
] ++ lib.optionals (!withPolkit) [
|
|
|
|
"-Dpolkit=disabled"
|
2022-08-12 12:06:08 +00:00
|
|
|
] ++ lib.optionals (!stdenv.isLinux) [
|
|
|
|
"-Dlibcap-ng=disabled"
|
2022-12-02 08:20:57 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isMusl [
|
|
|
|
"-Dcoroutine=gthread" # Fixes "Function missing:makecontext"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "GTK 3 SPICE widget";
|
|
|
|
longDescription = ''
|
|
|
|
spice-gtk is a GTK 3 SPICE widget. It features glib-based
|
|
|
|
objects for SPICE protocol parsing and a gtk widget for embedding
|
|
|
|
the SPICE display into other applications such as virt-manager.
|
|
|
|
Python bindings are available too.
|
|
|
|
'';
|
|
|
|
|
|
|
|
homepage = "https://www.spice-space.org/";
|
|
|
|
license = licenses.lgpl21;
|
|
|
|
maintainers = [ maintainers.xeji ];
|
2022-08-12 12:06:08 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|