git.iko.soy/typeable/nixpkgs
on master help sign in
gnome3.gdm: Always reset the environment for new sessions

When GDM launches a new session it will inherit the user's systemd environment (but only unset variables). If `__NIXOS_SET_ENVIRONMENT_DONE` is set in the user's systemd environment it will prevent the environment to be set properly or updated (eg. after having done a system rebuild). Gnome sessions exports their environment to systemd at startup. If something is keeping the user's systemd process alive (eg. ssh) launching a new gnome session after logging out will result in a broken PATH. Specifically the PATH will be inherited from GDM and never reset. We patch GDM to never inherit `__NIXOS_SET_ENVIRONMENT_DONE` so new sessions will always reset their base environment. fixes https://github.com/NixOS/nixpkgs/issues/48255 For more info about the environment setup: https://github.com/NixOS/nixpkgs/pull/45784

commitf908bf27305d80fca9b4955b3a758ca5c7ab4626 authorTor Hedin Brønner <torhedinbronner@gmail.com> dateMon 15 Oct 2018, 09:56 (8 years ago) parent8a3a91f
2 files changed+24
pkgs/desktops/gnome-3/core/gdm/default.nix+4 pkgs/desktops/gnome-3/core/gdm/reset-environment.patch+20
pkgs/desktops/gnome-3/core/gdm/default.nix+4
@@ -58,6 +58,10 @@ stdenv.mkDerivation rec {
5858 # Forwards certain environment variables to the gdm-x-session child process
5959 # to ensure that the above two patches actually work.
6060 ./gdm-session-worker_forward-vars.patch
61+
62+ # Set up the environment properly when launching sessions
63+ # https://github.com/NixOS/nixpkgs/issues/48255
64+ ./reset-environment.patch
6165 ];
6266
6367 installFlags = [
pkgs/desktops/gnome-3/core/gdm/reset-environment.patchnew file+20
@@ -0,0 +1,20 @@
1+--- a/daemon/gdm-wayland-session.c
2++++ b/daemon/gdm-wayland-session.c
3+@@ -285,6 +285,7 @@ spawn_session (State *state,
4+ "WAYLAND_DISPLAY",
5+ "WAYLAND_SOCKET",
6+ "GNOME_SHELL_SESSION_MODE",
7++ "__NIXOS_SET_ENVIRONMENT_DONE",
8+ NULL };
9+
10+ g_debug ("Running wayland session");
11+--- a/daemon/gdm-x-session.c
12++++ b/daemon/gdm-x-session.c
13+@@ -610,6 +610,7 @@ spawn_session (State *state,
14+ "WAYLAND_DISPLAY",
15+ "WAYLAND_SOCKET",
16+ "GNOME_SHELL_SESSION_MODE",
17++ "__NIXOS_SET_ENVIRONMENT_DONE",
18+ NULL };
19+
20+ g_debug ("Running X session");