diff options
author | Tor Hedin Brønner <torhedinbronner@gmail.com> | 2018-08-04 15:17:32 +0200 |
---|---|---|
committer | Tor Hedin Brønner <torhedinbronner@gmail.com> | 2018-12-10 10:27:00 +0100 |
commit | d54bfa8f4114a64747a6165c21599a5cc036e91a (patch) | |
tree | 49c9e96b867276a120692fe8fac6199bdb9e9b12 /pkgs/desktops | |
parent | 9895ce24b454980fbbebe90694d4317ec7ff2233 (diff) | |
download | nixpkgs-d54bfa8f4114a64747a6165c21599a5cc036e91a.tar nixpkgs-d54bfa8f4114a64747a6165c21599a5cc036e91a.tar.gz nixpkgs-d54bfa8f4114a64747a6165c21599a5cc036e91a.tar.bz2 nixpkgs-d54bfa8f4114a64747a6165c21599a5cc036e91a.tar.lz nixpkgs-d54bfa8f4114a64747a6165c21599a5cc036e91a.tar.xz nixpkgs-d54bfa8f4114a64747a6165c21599a5cc036e91a.tar.zst nixpkgs-d54bfa8f4114a64747a6165c21599a5cc036e91a.zip |
gnome3.gnome-session: prevent crash when launching wayland sessions
gnome-session inherits GDMS PATH, which is at the moment non-functional. In X11 this didn't matter as the `Xsession` wrapper would populate the environment beforehand. Wayland sessions doesn't source `Xesssion` (duh), so we patch `bin/gnome-session` to use absolute paths for `grep` and `bash`. In addition `bin/gnome-session` is a simple wrapper around `libexec/gnome-session-binary` mostly responsible for sourcing the users profile before launching the binary. This made our wrapping of `bin/gnome-session` ineffective on wayland as the profile would reset the environment. Simply wrap `libexec/gnome-session-binary` instead.
Diffstat (limited to 'pkgs/desktops')
-rw-r--r-- | pkgs/desktops/gnome-3/core/gnome-session/default.nix | 9 | ||||
-rw-r--r-- | pkgs/desktops/gnome-3/core/gnome-session/fix-paths.patch | 18 |
2 files changed, 24 insertions, 3 deletions
diff --git a/pkgs/desktops/gnome-3/core/gnome-session/default.nix b/pkgs/desktops/gnome-3/core/gnome-session/default.nix index ceda3dfd56f..2f44a4e168d 100644 --- a/pkgs/desktops/gnome-3/core/gnome-session/default.nix +++ b/pkgs/desktops/gnome-3/core/gnome-session/default.nix @@ -1,6 +1,6 @@ { fetchurl, stdenv, substituteAll, meson, ninja, pkgconfig, gnome3, glib, gtk, gsettings-desktop-schemas , gnome-desktop, dbus, json-glib, libICE, xmlto, docbook_xsl, docbook_xml_dtd_412, python3 -, libxslt, gettext, makeWrapper, systemd, xorg, epoxy }: +, libxslt, gettext, makeWrapper, systemd, xorg, epoxy, gnugrep, bash }: stdenv.mkDerivation rec { name = "gnome-session-${version}"; @@ -16,6 +16,8 @@ stdenv.mkDerivation rec { src = ./fix-paths.patch; gsettings = "${glib.bin}/bin/gsettings"; dbusLaunch = "${dbus.lib}/bin/dbus-launch"; + grep = "${gnugrep}/bin/grep"; + bash = "${bash}/bin/bash"; }) ]; @@ -37,8 +39,11 @@ stdenv.mkDerivation rec { patchShebangs meson_post_install.py ''; + # `bin/gnome-session` will reset the environment when run in wayland, we + # therefor wrap `libexec/gnome-session-binary` instead which is the actual + # binary needing wrapping preFixup = '' - wrapProgram "$out/bin/gnome-session" \ + wrapProgram "$out/libexec/gnome-session-binary" \ --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ --suffix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \ --suffix XDG_DATA_DIRS : "${gnome3.gnome-shell}/share"\ diff --git a/pkgs/desktops/gnome-3/core/gnome-session/fix-paths.patch b/pkgs/desktops/gnome-3/core/gnome-session/fix-paths.patch index c1b5ebe842f..fe4feaf7085 100644 --- a/pkgs/desktops/gnome-3/core/gnome-session/fix-paths.patch +++ b/pkgs/desktops/gnome-3/core/gnome-session/fix-paths.patch @@ -1,6 +1,22 @@ --- a/gnome-session/gnome-session.in +++ b/gnome-session/gnome-session.in -@@ -13,7 +13,7 @@ if [ "x$XDG_SESSION_TYPE" = "xwayland" ] && +@@ -3,11 +3,11 @@ + if [ "x$XDG_SESSION_TYPE" = "xwayland" ] && + [ "x$XDG_SESSION_CLASS" != "xgreeter" ] && + [ -n "$SHELL" ] && +- grep -q "$SHELL" /etc/shells && +- ! (echo "$SHELL" | grep -q "false") && +- ! (echo "$SHELL" | grep -q "nologin"); then ++ @grep@ -q "$SHELL" /etc/shells && ++ ! (echo "$SHELL" | @grep@ -q "false") && ++ ! (echo "$SHELL" | @grep@ -q "nologin"); then + if [ "$1" != '-l' ]; then +- exec bash -c "exec -l '$SHELL' -c '$0 -l $*'" ++ exec @bash@ -c "exec -l '$SHELL' -c '$0 -l $*'" + else + shift + fi +@@ -13,7 +13,7 @@ fi fi |