nixpkgs/pkgs/desktops/gnome-3/core/gnome-session/default.nix
Tor Hedin Brønner d54bfa8f41 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.
2018-12-10 10:27:00 +01:00

68 lines
2.2 KiB
Nix

{ 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, gnugrep, bash }:
stdenv.mkDerivation rec {
name = "gnome-session-${version}";
version = "3.30.1";
src = fetchurl {
url = "mirror://gnome/sources/gnome-session/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
sha256 = "0fbpq103md4g9gi67rxnwvha21629nxx7qazddy6q6494sbqbzpa";
};
patches = [
(substituteAll {
src = ./fix-paths.patch;
gsettings = "${glib.bin}/bin/gsettings";
dbusLaunch = "${dbus.lib}/bin/dbus-launch";
grep = "${gnugrep}/bin/grep";
bash = "${bash}/bin/bash";
})
];
mesonFlags = [ "-Dsystemd=true" ];
nativeBuildInputs = [
meson ninja pkgconfig gettext makeWrapper
xmlto libxslt docbook_xsl docbook_xml_dtd_412 python3
dbus # for DTD
];
buildInputs = [
glib gtk libICE gnome-desktop json-glib xorg.xtrans gnome3.defaultIconTheme
gnome3.gnome-settings-daemon gsettings-desktop-schemas systemd epoxy
];
postPatch = ''
chmod +x meson_post_install.py # patchShebangs requires executable file
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/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"\
--suffix XDG_CONFIG_DIRS : "${gnome3.gnome-settings-daemon}/etc/xdg"
'';
passthru = {
updateScript = gnome3.updateScript {
packageName = "gnome-session";
attrPath = "gnome3.gnome-session";
};
};
meta = with stdenv.lib; {
description = "GNOME session manager";
homepage = https://wiki.gnome.org/Projects/SessionManagement;
license = licenses.gpl2Plus;
maintainers = gnome3.maintainers;
platforms = platforms.linux;
};
}