Skip to content

Upstream sessions#43992

Merged
jtojnar merged 14 commits intoNixOS:masterfrom
jtojnar:upstream-sessions
Aug 3, 2018
Merged

Upstream sessions#43992
jtojnar merged 14 commits intoNixOS:masterfrom
jtojnar:upstream-sessions

Conversation

@jtojnar
Copy link
Member

@jtojnar jtojnar commented Jul 23, 2018

Motivation for this change

See #39871

This is just a first swallow, in the future pull requests we will want to convert more DEs and investigate Wayland.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
  • Tested via one or more NixOS tests
    • gnome3
    • gnome3-gdm
  • Tried to run upstream xsession (GNOME) in VM
    • with GDM
    • with lightdm
    • with SDDM
  • Tried to run legacy xsession (Xfce) in VM
    • with lightdm
    • with gdm
  • Tried to run legacy combined xsession (xmonad+xterm) in VM
    • with lightdm
    • with gdm
  • Fits CONTRIBUTING.md.

cc @hedning, @worldofpeace

@GrahamcOfBorg GrahamcOfBorg added 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jul 23, 2018
@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Jul 23, 2018
@GrahamcOfBorg
Copy link

No attempt on x86_64-darwin (full log)

The following builds were skipped because they don't evaluate on x86_64-darwin: gnome3.gdm, gnome3.gpaste

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: gnome3.gdm, gnome3.gpaste

Partial log (click to expand)

cannot build derivation '/nix/store/rnnrdjhvrarz8gmvfsmwq5lbpq2914iq-libgdata-0.17.9.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/rp8fzf629m8rx183yy5qy1dn2r530a7x-evolution-data-server-3.28.3.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/qf87jknlll6jn3ix547l6nvrzspqf0g6-grilo-plugins-0.3.5.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/6j3fiy4b8b8s865griqk6p3dg71cyn2z-tracker-miners-2.0.5.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/mb30fs25s83y8msliivqj814pbwnxd2m-nautilus-3.28.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/4x8933079xainrzq1db39r5mbjacsbbq-totem-3.26.1.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/7awmzq1rhzbw7z59zw7zy3gnj97y4nd9-cheese-3.28.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/lr6574abdh70w9byyx4f7irp1ia8q6f0-gnome-control-center-3.28.2.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/sx6qhvgpjcfh3jlr0sinsl7vgjnm9jwa-gpaste-3.28.2.drv': 1 dependencies couldn't be built
error: build of '/nix/store/sx6qhvgpjcfh3jlr0sinsl7vgjnm9jwa-gpaste-3.28.2.drv' failed

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: gnome3.gdm, gnome3.gpaste

Partial log (click to expand)

cannot build derivation '/nix/store/lb3h5kiynhps8dafikvzbrdn46q3af7d-libgdata-0.17.9.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ryvb61q946n7s6mk2pm0k6yi36a2syij-evolution-data-server-3.28.3.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/lgch03spbz8mnsp92nxxhq3xxg9fqz08-grilo-plugins-0.3.5.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/ysn1xfa6xqhn12jfyih1n1b6nb59k2aq-tracker-miners-2.0.5.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/9nyfnlhrcmjwz5xgl9wzi1fnvf5m0yks-nautilus-3.28.1.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/8zplz5hcjw7hnm7bki1brvh283ppj7qd-totem-3.26.1.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/9l2n51vhd9syqzn4kfwaap76n04h0lyi-cheese-3.28.0.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/k1961fyvc9ihk96z5g84z832vyjv0qpx-gnome-control-center-3.28.2.drv': 11 dependencies couldn't be built
cannot build derivation '/nix/store/9bmz49x5zamxzcidl02nzxish9y7pn5b-gpaste-3.28.2.drv': 4 dependencies couldn't be built
error: build of '/nix/store/3yb1f44wmdpz6ivgcz9rr9lb7y9xjjq2-gdm-3.28.2.drv', '/nix/store/9bmz49x5zamxzcidl02nzxish9y7pn5b-gpaste-3.28.2.drv' failed

@hedning
Copy link
Contributor

hedning commented Jul 23, 2018

This seems like good start :)

Did a little testing (with gdm):

Login

Disregard, had a bad .xprofile that crashed the session.

1. Tested in a VM without password, which worked as expected
2. Tested on hardware with my regular user and couldn't log in

I'm getting this in the log:

juli 23 13:10:16 x1 gdm-password][4245]: gkr-pam: no password is available for user

Not sure how to reproduce in a VM as the user.password option is ignored for some reason.

GPaste

Gnome-control-center can't find the necessary gpaste schema, so it crashes:

  1. Started Gnome Shell in a VM (passwordless user) with services.gnome3.gpaste.enabled = true.
  2. Turned on the gpaste extension.
  3. Tried launching gnome-control-center

Resulting in:

Jul 23 11:27:04 nixos .gnome-control-[1908]: Settings schema 'org.gnome.GPaste' is not installed

@jtojnar
Copy link
Member Author

jtojnar commented Jul 23, 2018

Add Login, maybe this:

If the option users.mutableUsers is true, the password defined in one of the three options will only be set when the user is created for the first time.

Ad GPaste, that is probably the keyboard shortcuts XML file. I do not think it is possible Maybe we could create gnome-control-center-with-plugins expression. Or just give up and re-add the session path (though I am not sure how to do it).

I tried lightdm now, but it does not even see the session. Also in the log, I see ** (lightdm-gtk-greeter:802): WARNING **: 11:41:49.170: [PIDs] Failed to execute command: /usr/lib/at-spi2-core/at-spi-bus-launcher

@hedning
Copy link
Contributor

hedning commented Jul 23, 2018

Right, setting mutable users to false made login work with a hardcoded password in a VM, not sure why it won't work on my hardware though (tested on two machines now, will investigate some more).

@jtojnar
Copy link
Member Author

jtojnar commented Jul 23, 2018

Regarding GPaste, I guess, we also could extend the KeyListEntries in the XML file with schemadir attribute and patch Control Center to respect it.

description = "Enable Gnome 3 desktop manager.";
};

sessionPath = mkOption {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to redirect users to the new option (extraSessionFilePackages?) instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It serves a completely different purpose. The replacement to sessionPath is fixing packages.

@hedning
Copy link
Contributor

hedning commented Jul 23, 2018

(had a bad .xprofile which caused the crash).

Another option for GPaste would be to compile the schema in /run/current-system/sw/share/glib-2.0/..., not sure if that's possible in a module though?

@jtojnar
Copy link
Member Author

jtojnar commented Jul 23, 2018

Yep, doing as you suggest in #42176 (comment) would be another possibility.

@worldofpeace
Copy link
Contributor

Hmm, sddm doesn't see the session either. Maybe that's missing something.

@jtojnar
Copy link
Member Author

jtojnar commented Jul 23, 2018

There is TryExec=gnome-session in ${gnome3.gnome-session}/share/xsessions/gnome.desktop, so we probably need to patch that to absolute path.

@worldofpeace
Copy link
Contributor

I thought it was already doing that,

sed -i "s,^Exec=gnome-session,Exec=$out/bin/gnome-session," $desktopFile

@jtojnar
Copy link
Member Author

jtojnar commented Jul 23, 2018

Well there is ^, so only lines starting with Exec will be matched.

@worldofpeace
Copy link
Contributor

Oh, I skimmed and didn't notice TryExec.

@worldofpeace
Copy link
Contributor

This should be fine

diff --git a/pkgs/desktops/gnome-3/core/gnome-session/default.nix b/pkgs/desktops/gnome-3/core/gnome-session/default.nix
index 7b407aad506..6f9cc384fa2 100644
--- a/pkgs/desktops/gnome-3/core/gnome-session/default.nix
+++ b/pkgs/desktops/gnome-3/core/gnome-session/default.nix
@@ -33,8 +33,10 @@ stdenv.mkDerivation rec {
   preFixup = ''
     for desktopFile in $(grep -rl "Exec=gnome-session" $out/share)
     do
-      echo "Patching gnome-session path in: $desktopFile"
+      echo "Patching Exec gnome-session path in: $desktopFile"
       sed -i "s,^Exec=gnome-session,Exec=$out/bin/gnome-session," $desktopFile
+      echo "Patching TryExec gnome-sesison path in: $desktopFile"
+      sed -i "s,^TryExec=gnome-session,TryExec=$out/bin/gnome-session," $desktopFile
     done
     wrapProgram "$out/bin/gnome-session" \
       --prefix PATH : "${glib.dev}/bin" \

@worldofpeace
Copy link
Contributor

Also,

debug = mkEnableOption "gnome-session debug messages";

It would be nice to still have an interface to do that.

@jtojnar
Copy link
Member Author

jtojnar commented Jul 23, 2018

Adding environment.variables.GNOME_SESSION_DEBUG = "1"; will probably be the easiest.

@worldofpeace
Copy link
Contributor

Do these lightdm errors look of any interest?

@jtojnar
Copy link
Member Author

jtojnar commented Jul 23, 2018

Not particularly.

With the latest commit, I am able to launch GNOME Shell in lightdm in VM, but it does not seem to receive environment variables (including PATH).

Also, I opened https://gitlab.gnome.org/GNOME/gnome-session/merge_requests/5 so we could drop the substs.

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh so that's what it was about.

@GrahamcOfBorg
Copy link

No attempt on x86_64-darwin (full log)

The following builds were skipped because they don't evaluate on x86_64-darwin: gnome3.gdm, gnome3.gnome-session, gnome3.gpaste

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: gnome3.gdm, gnome3.gnome-session, gnome3.gpaste

Partial log (click to expand)

strip is /nix/store/fzsyclvxz1p2ia83caniy93v8cwarg0j-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/aw3hz1qsfas7hdnpqr8s27zzjnwlgv8g-cheese-3.28.0-man
checking for references to /build in /nix/store/aw3hz1qsfas7hdnpqr8s27zzjnwlgv8g-cheese-3.28.0-man...
shrinking RPATHs of ELF executables and libraries in /nix/store/bbrqw0s42lcfk6fr2rn213hj11hnl41d-cheese-3.28.0-devdoc
strip is /nix/store/fzsyclvxz1p2ia83caniy93v8cwarg0j-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/bbrqw0s42lcfk6fr2rn213hj11hnl41d-cheese-3.28.0-devdoc
checking for references to /build in /nix/store/bbrqw0s42lcfk6fr2rn213hj11hnl41d-cheese-3.28.0-devdoc...
cannot build derivation '/nix/store/vsysn71qypglwai1slisdjsi6sd80mgd-gnome-control-center-3.28.2.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/4zg3d8a52r9534a6y43di3p8s3afg7rc-gpaste-3.28.2.drv': 1 dependencies couldn't be built
error: build of '/nix/store/4zg3d8a52r9534a6y43di3p8s3afg7rc-gpaste-3.28.2.drv', '/nix/store/8vj9kcg09n2nm17c3n5jwidq8znl9f7z-gnome-session-3.28.1.drv' failed

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: gnome3.gdm, gnome3.gnome-session, gnome3.gpaste

Partial log (click to expand)

checking for references to /build in /nix/store/ypphf619vmn6z5p67vriczj2na7blsy1-pipewire-0.1.9-dev...
shrinking RPATHs of ELF executables and libraries in /nix/store/2hb889kzpcyk6f3d6bf3w6dy12whbdvg-pipewire-0.1.9-doc
strip is /nix/store/h0nc84ybvb8g724fwysvcghh1675wjli-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/2hb889kzpcyk6f3d6bf3w6dy12whbdvg-pipewire-0.1.9-doc
checking for references to /build in /nix/store/2hb889kzpcyk6f3d6bf3w6dy12whbdvg-pipewire-0.1.9-doc...
cannot build derivation '/nix/store/4wc99hxdlbh9ylngad9ass3wks2c99nc-mutter-3.28.2.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/2d6yjkl45w8cn0b83zhjjapy58ydxh0m-gnome-shell-3.28.2.drv': 14 dependencies couldn't be built
cannot build derivation '/nix/store/1y93zl13zqz9jipb8b35i6ypaqy05nwx-gpaste-3.28.2.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/pw75dadrx3licq6n5p813fng7z2y32v3-gnome-session-3.28.1.drv': 3 dependencies couldn't be built
error: build of '/nix/store/1y93zl13zqz9jipb8b35i6ypaqy05nwx-gpaste-3.28.2.drv', '/nix/store/7myq2453dx5zmyjgf7nkp2zrf3n2m4sy-gdm-3.28.2.drv', '/nix/store/pw75dadrx3licq6n5p813fng7z2y32v3-gnome-session-3.28.1.drv' failed

jtojnar and others added 7 commits August 1, 2018 19:14
Pass gnome-session to extraSessionFilePackages, remove unnecessary environment variables, move the rest out of old session option, and then drop the option.
TryExec needs absolute path too, otherwise the desktop file will be ignored
unless gnome-session is in PATH, in which case, we would not need to patch
Exec.
This makes it easier to support a wider variety of .desktop session files. In
particular this makes it possible to use both the «legacy» sessions and upstream
session files.

We separate `xsession` into two parts, `xsessionWrapper` and `xsession`.
`xsessionWrapper` sets up the correct environment and then lauches the session's
Exec command (from the .desktop file), falling back to launching the default
window/desktopManager through the `xsession` script (required by at least some
nixos tests).

`xsession` then _only_ handles launching desktop-managers/window-managers defined
through `services.xserver.desktopManager.session`.
The default session might be found in `extraSessionFilePackages`, but it's not
viable to detect at evaluation time, so emit a warning.

In LightDM instead of checking `defaultSessionName` against
`displayManager.session.names` we rely on the assertions in
`desktopManager` and `windowMananger` and just check that there's at least one
default set. The second assertion could never actually be triggered.
Sessions from `extraSessionFilePackages` isn't picked automatically as the
default session.
Implement through `services.xserver.displayManager.sessionCommands`.
@jtojnar jtojnar force-pushed the upstream-sessions branch from 0e364e9 to ea3568d Compare August 1, 2018 17:15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really minor punctuation nit:

"Note that this should be a last resort; patching the package is preferred (see GPaste)."
"Note that this should be a last resort, and patching the package is preferred (see GPaste)."

(either of the above is fine)

@jtojnar jtojnar force-pushed the upstream-sessions branch from ea3568d to 62e665e Compare August 1, 2018 18:36
@jtojnar jtojnar added 9.needs: community feedback This needs feedback from more community members. and removed 2.status: work-in-progress labels Aug 1, 2018
@jtojnar
Copy link
Member Author

jtojnar commented Aug 1, 2018

Thanks @hedning, now it looks like it is ready to go; all tasks completed and tests passing.

There is a space for more clean-ups, for example, removing pulseaudio from the session wrapper (it is supposed to be socket-activated on modern systems), but we can leave it for future PRs.

Asking maintainers of other DEs for their input: @ttuegel (KDE), @romildo (lxqt), @yegortimoshenko (xfce).

@hedning
Copy link
Contributor

hedning commented Oct 7, 2018

@worldofpeace @jtojnar We could check that the default session exists when actually building the desktops derivation perhaps?

mkDesktops = names: pkgs.runCommand "desktops"

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/gnome-control-center-wont-start-gpaste-settings-schema-not-installed/7479/4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 9.needs: community feedback This needs feedback from more community members. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants