Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream sessions #43992

Merged
merged 14 commits into from Aug 3, 2018
Merged

Upstream sessions #43992

merged 14 commits into from Aug 3, 2018

Conversation

jtojnar
Copy link
Contributor

@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
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
Contributor 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
Contributor 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.

@@ -55,14 +55,6 @@ in {
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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor 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.


jtojnar and others added 6 commits August 1, 2018 19:14
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`.
Additional list of packages to be added to the session search path.
Useful for GNOME Shell extensions or GSettings-conditional autostart.

Note that this should be a last resort, patching the package is preferred (see GPaste).
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
Copy link
Contributor 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).

@jtojnar jtojnar added this to the 18.09 milestone Aug 1, 2018
@jtojnar jtojnar merged commit f735d6a into NixOS:master Aug 3, 2018
GNOME automation moved this from In Progress to Done Aug 3, 2018
@jtojnar jtojnar deleted the upstream-sessions branch August 3, 2018 12:23
@jtojnar jtojnar mentioned this pull request Aug 15, 2018
9 tasks
@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
Projects
GNOME
  
Done
Wayland
  
GNOME/GTK specific
Development

Successfully merging this pull request may close these issues.

None yet

7 participants