git.iko.soy/typeable/nixpkgs
on master help sign in
spice-gtk: fix symlink errors, add withPolkit option
commite26810069eb093b991d8d4f4c9caab321efba7b0 authorxeji <xeji@cat3.de> dateFri 16 Mar 2018, 18:09 (9 years ago) parente718df6
1 file changed+30−14
pkgs/development/libraries/spice-gtk/default.nix+30−14
pkgs/development/libraries/spice-gtk/default.nix+30−14
@@ -1,8 +1,29 @@
11{ stdenv, fetchurl, pkgconfig, spice-protocol, gettext, celt_0_5_1
22, openssl, libpulseaudio, pixman, gobjectIntrospection, libjpeg_turbo, zlib
33, cyrus_sasl, python2Packages, autoreconfHook, usbredir, libsoup
4−, polkit, acl, usbutils, vala
5−, gtk3, epoxy }:
4+, withPolkit ? true, polkit, acl, usbutils
5+, vala, gtk3, epoxy }:
6+
7+# If this package is built with polkit support (withPolkit=true),
8+# usb redirection reqires spice-client-glib-usb-acl-helper to run setuid root.
9+# The helper confirms via polkit that the user has an active session,
10+# then adds a device acl entry for that user.
11+# Example NixOS config to create a setuid wrapper for the helper:
12+# security.wrappers.spice-client-glib-usb-acl-helper.source =
13+# "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper";
14+# On non-NixOS installations, make a setuid copy of the helper
15+# outside the store and adjust PATH to find the setuid version.
16+
17+# If this package is built without polkit support (withPolkit=false),
18+# usb redirection requires read-write access to usb devices.
19+# This can be granted by adding users to a custom group like "usb"
20+# and using a udev rule to put all usb devices in that group.
21+# Example NixOS config:
22+# users.groups.usb = {};
23+# users.users.dummy.extraGroups = [ "usb" ];
24+# services.udev.extraRules = ''
25+# KERNEL=="*", SUBSYSTEMS=="usb", MODE="0664", GROUP="usb"
26+# '';
627
728with stdenv.lib;
829
@@ -18,11 +39,16 @@ in stdenv.mkDerivation rec {
1839 sha256 = "1vknp72pl6v6nf3dphhwp29hk6gv787db2pmyg4m312z2q0hwwp9";
1940 };
2041
42+ postPatch = ''
43+ # get rid of absolute path to helper in store so we can use a setuid wrapper
44+ substituteInPlace src/usb-acl-helper.c \
45+ --replace 'ACL_HELPER_PATH"/' '"'
46+ '';
47+
2148 buildInputs = [
2249 spice-protocol celt_0_5_1 openssl libpulseaudio pixman
2350 libjpeg_turbo zlib cyrus_sasl python pygtk usbredir gtk3 epoxy
24− polkit acl usbutils
25− ];
51+ ] ++ optionals withPolkit [ polkit acl usbutils ] ;
2652
2753 nativeBuildInputs = [ pkgconfig gettext libsoup autoreconfHook vala gobjectIntrospection ];
2854
@@ -34,16 +60,6 @@ in stdenv.mkDerivation rec {
3460 "--enable-vala"
3561 ];
3662
37− # usb redirection needs spice-client-glib-usb-acl-helper to run setuid root
38− # the helper then uses polkit to check access
39− # in nixos, enable this with
40− # security.wrappers.spice-client-glib-usb-acl-helper.source =
41− # "${pkgs.spice_gtk}/bin/spice-client-glib-usb-acl-helper.real";
42− postFixup = ''
43− mv $out/bin/spice-client-glib-usb-acl-helper $out/bin/spice-client-glib-usb-acl-helper.real
44− ln -sf /run/wrappers/bin/spice-client-glib-usb-acl-helper $out/bin/spice-client-glib-usb-acl-helper
45− '';
46−
4763 dontDisableStatic = true; # Needed by the coroutine test
4864
4965 enableParallelBuilding = true;