nixpkgs/pkgs/desktops/plasma-5/kwin/default.nix
Samuel Dionne-Riel 1ba2080046 kwin: Unwrap executable name for desktop file search
KWin for wayland uses the `.desktop` file to determine whether a process
is allowed to access some wayland services.

This would be fine if there was a stable interface to map a process to a
`.desktop` file.

Since there is no such interface, they are scanning `.desktop` files for
one where the executable path matches the resolved file "exe" from
`/proc/$PID/exe`.

This would be fine, if we didn't wrap many (most?) KDE/Plasma binaries.

Since we are wrapping binaries, the `exe` symlink points to a wrapped
binary. No `.desktop` file will match for the wrapped binary.

The solution here is to peel away at the `.${name}-wrapped` layers until
we have the intended name for the executable.

It is expected that no `.desktop` file will ever point to a wrapped
binary.
2021-03-25 14:17:40 -04:00

56 lines
2.1 KiB
Nix

{
mkDerivation, lib, fetchpatch,
extra-cmake-modules, kdoctools,
epoxy,libICE, libSM, libinput, libxkbcommon, udev, wayland, xcb-util-cursor,
xwayland,
qtdeclarative, qtmultimedia, qtquickcontrols2, qtscript, qtsensors,
qtvirtualkeyboard, qtx11extras,
breeze-qt5, kactivities, kcompletion, kcmutils, kconfig, kconfigwidgets,
kcoreaddons, kcrash, kdeclarative, kdecoration, kglobalaccel, ki18n,
kiconthemes, kidletime, kinit, kio, knewstuff, knotifications, kpackage,
kscreenlocker, kservice, kwayland, kwayland-server, kwidgetsaddons, kwindowsystem, kxmlgui,
plasma-framework, libcap, libdrm, mesa, pipewire
}:
# TODO (ttuegel): investigate qmlplugindump failure
mkDerivation {
name = "kwin";
nativeBuildInputs = [ extra-cmake-modules kdoctools ];
buildInputs = [
epoxy libICE libSM libinput libxkbcommon udev wayland xcb-util-cursor
xwayland
qtdeclarative qtmultimedia qtquickcontrols2 qtscript qtsensors
qtvirtualkeyboard qtx11extras
breeze-qt5 kactivities kcmutils kcompletion kconfig kconfigwidgets
kcoreaddons kcrash kdeclarative kdecoration kglobalaccel ki18n kiconthemes
kidletime kinit kio knewstuff knotifications kpackage kscreenlocker kservice
kwayland kwayland-server kwidgetsaddons kwindowsystem kxmlgui plasma-framework
libcap libdrm mesa pipewire
];
outputs = [ "dev" "out" ];
patches = [
./0001-follow-symlinks.patch
./0002-xwayland.patch
./0003-plugins-qpa-allow-using-nixos-wrapper.patch
./0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch
];
CXXFLAGS = [
''-DNIXPKGS_XWAYLAND=\"${lib.getBin xwayland}/bin/Xwayland\"''
];
cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF" ];
postInstall = ''
# Some package(s) refer to these service types by the wrong name.
# I would prefer to patch those packages, but I cannot find them!
ln -s ''${!outputBin}/share/kservicetypes5/kwineffect.desktop \
''${!outputBin}/share/kservicetypes5/kwin-effect.desktop
ln -s ''${!outputBin}/share/kservicetypes5/kwinscript.desktop \
''${!outputBin}/share/kservicetypes5/kwin-script.desktop
'';
}