diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix index ee2c0e0bd1c5..6dc158600fd1 100644 --- a/pkgs/servers/pulseaudio/default.nix +++ b/pkgs/servers/pulseaudio/default.nix @@ -116,6 +116,11 @@ stdenv.mkDerivation rec { "-Dsysconfdir=/etc" "-Dsysconfdir_install=${placeholder "out"}/etc" "-Dudevrulesdir=${placeholder "out"}/lib/udev/rules.d" + + # pulseaudio complains if its binary is moved after installation; + # this is needed so that wrapGApp can operate *without* + # renaming the unwrapped binaries (see below) + "--bindir=${placeholder "out"}/.bin-unwrapped" ] ++ lib.optional (stdenv.isLinux && useSystemd) "-Dsystemduserunitdir=${placeholder "out"}/lib/systemd/user" ++ lib.optionals stdenv.isDarwin [ @@ -133,11 +138,11 @@ stdenv.mkDerivation rec { postInstall = lib.optionalString libOnly '' find $out/share -maxdepth 1 -mindepth 1 ! -name "vala" -prune -exec rm -r {} \; find $out/share/vala -maxdepth 1 -mindepth 1 ! -name "vapi" -prune -exec rm -r {} \; - rm -r $out/{bin,etc,lib/pulse-*} + rm -r $out/{.bin-unwrapped,etc,lib/pulse-*} '' + '' moveToOutput lib/cmake "$dev" - rm -f $out/bin/qpaeq # this is packaged by the "qpaeq" package now, because of missing deps + rm -f $out/.bin-unwrapped/qpaeq # this is packaged by the "qpaeq" package now, because of missing deps ''; preFixup = lib.optionalString (stdenv.isLinux && (stdenv.hostPlatform == stdenv.buildPlatform)) '' @@ -151,6 +156,15 @@ stdenv.mkDerivation rec { ln -s "''$file" "''${file%.dylib}.so" ln -s "''$file" "$out/lib/pulseaudio/''$(basename ''$file .dylib).so" done + '' + # put symlinks to binaries in `$prefix/bin`; + # then wrapGApp will *rename these symlinks* instead of + # the original binaries in `$prefix/.bin-unwrapped` (see above); + # when pulseaudio is looking for its own binary (it does!), + # it will be happy to find it in its original installation location + + lib.optionalString (!libOnly) '' + mkdir -p $out/bin + ln -st $out/bin $out/.bin-unwrapped/* ''; passthru = {