Skip to content

Add Wayland Support #5071

Closed
Closed

Description

@drvirgilio

I would love to help give NixOS full support for running wayland natively. As you may know wayland is a protocol which aims to replace the antiquated X11 protocol and replace it with something more modern. I'm putting together a list of some tasks . As always, I'm biased and don't know much so any input is greatly appreciated!

  • Weston reference implementation
  • Xwayland support: Run X11 apps on Wayland (new package: xwayland #5061)
    • Test essential applications
  • Support for wayland in NixOS config
    • Boot into system compositor
    • Login to session compositor
  • Package applications which support wayland natively
  • Package WMs with wayland and Xwayland support
    • kwin (kde)
    • mutter (gnome)
    • xmonad (no wayland support planned upstream)
    • sway (i3)
    • way-cooler

What do you think? How long would it take? Where is the low hanging fruit and which tasks are most difficult? Thanks for everything and happy hacking!

Activity

  1. vcunat commented on Nov 21, 2014

    @vcunat
    Member

    IIRC gtk3 supports wayland natively, so I presume most gtk3 apps should just work out of the box. The whole gnome3 stack should be a low-hanging fruit (because upstream supports it). The WMs you listed are packaged, only they may need some (X)wayland tweaks.

  2. added
    6.topic: nixos
    0.kind: enhancement
    on Nov 21, 2014
  3. auntieNeo commented on Feb 5, 2015

    @auntieNeo
    Contributor

    I have started working on writing NixOS modules for Wayland compositors, out of my own interest in using Wayland as a primary window environment. I have hit a snag where compositors (both weston-launch and swc-launch) will segfault, but only when running as systemd services. I've been sidetracked into trying to collect core dumps of those processes, but I suspect it has something to do with systemd sandboxing.

    Right now I'm just making modules as simple systemd services, but I think it might be best to somehow incorporate Wayland sessions into the existing X11 display-manager/session configuration. It is conceivable that one might launch a Wayland compositor from an X11 display manager and vice-versa. I fear this will add a lot of multiplicity to the options, but I believe more than one person will want this during the X11 to Wayland transition period. (Personally, I will just be using auto-login, so I'm open to whatever works)

    There have been a number of lesser-known compositors popping up, many of them on github. There's a good list on the Arch Wiki. I might add packages for a few of those as I test them out.

    My only goal right now is boot to Wayland. It shouldn't be difficult to do, but doing it right with all of the right options exposed could be tricky.

  4. lucabrunox commented on Feb 5, 2015

    @lucabrunox
    Contributor

    @auntieNeo consider checking journalctl, most likely you find the reason of the crash there.

    About core dumps, it may be worthwhile for you to look at this function:

    debugVersion = pkg: lib.overrideDerivation pkg (attrs: {

    It will tweak the build of a derivation to include debug symbols.

    Also another think you should note, is that opengl needs LD_LIBRARY_PATH to be correctly set. It's done by default on user environments, don't know if it's also in systemd service variables by default.

  5. vcunat commented on Feb 5, 2015

    @vcunat
    Member

    Before inspecting coredumps, just using strace might be more efficient (to see what resources are accessed right before the crash).

  6. auntieNeo commented on Feb 5, 2015

    @auntieNeo
    Contributor

    journalctl is what told me that it was segfaulting in the first place. My second instinct was to use strace, but I quickly discovered that setuid-wrapper.c has code that prevents it from running with strace here: https://github.com/NixOS/nixos/blob/master/modules/security/setuid-wrapper.c#L46

    Without strace, I figured a core dump would be my only option. It took a while to figure out, but I enabled core dump collection in systemd. I have a pull request that adds the NixOS config niceties for enabling it here: #6168

    @lethalman Thanks for the debugVersion tip. I was having trouble getting symbols in my core dump before I started using that.

    tl;dr: I found and patched the segfault and sent it upstream. Now that it's working, I'll try to get a NixOS config interface fleshed out that works with multiple system/session compositors.

  7. lucabrunox commented on Feb 6, 2015

    @lucabrunox
    Contributor

    Great @auntieNeo , will review your PR about the coredump.

  8. trishume commented on Feb 7, 2015

    @trishume
    Contributor

    This is awesome! NixOS is already awesome and the moment it supports Wayland well I will switch to it for my main computer. Depending on how annoyed I get at my current system I might ragequit earlier and help with the effort. I'm not at that point yet, but it's tempting.

    👍

  9. MaddieM4 commented on Feb 19, 2015

    @MaddieM4
    Contributor

    We have XWayland marked as done, as per previous ticket. However, it's not documented how to install a version of Weston that has the optional dependency supplied. Possibly that's in some more general documentation area, but my google-fu is lacking, and this seems like it should be more straightforward than it is.

    Could anyone provide guidance on how to install Weston with XWayland?

  10. vcunat commented on Feb 19, 2015

    @vcunat
    Member

    Weston (the non-lite version) comes with XWayland support. Only it doesn't compile in current master 170775a834#commitcomment-9748711.

  11. yacinehmito commented on Dec 8, 2015

    @yacinehmito
    Contributor

    Bumping!

    How is the integration of Wayland going? I packaged a Wayland window manager -- see SirCmpwn/sway and my nixpkgs fork for the nix expression -- and I'd like to know if someone thought of an API akin to the X11 one for Nix. I'd very much like to contribute but as it impacts a lot more than this little package I'm afraid to touch anything before getting any insight.

  12. vcunat commented on Dec 13, 2015

    @vcunat
    Member

    I don't understand what kind of API you mean; can you explain?

  13. 49 remaining items

  14. primeos commented on Jun 19, 2019

    @primeos
    Member

    @NilsIrl from #55119 (comment):

    The problem is that you can spawn firefox from an XWayland window within a wayland session (e.g. sway) and then firefox also defaults to using XWayland. By setting the desired backend explicitly you can workaround that issue. Most distributions (AFIK fedora & ubuntu) ship a shim package for the very same purpose.

    But normally setting GDK_BACKEND to wayland should already be enough and IMO, in general, we should prefer setting this by default rather than introducing additional packages for Wayland (but I haven't had a closer look at the Firefox case).

  15. NilsIrl commented on Jun 20, 2019

    @NilsIrl
    Member

    @primeos So far I have been totally unable to run firefox under wayland natively. I'm pretty sure I have tried every possible combination.

    firefox and firefox-wayland with GDK_BACKEND and MOZ_ENABLE_WAYLAND correctly set.

  16. Soundtoxin commented on Aug 22, 2019

    @Soundtoxin

    I see xmonad crossed out. There's a project called waymonad that appears to be like xmonad for wayland. It seems very WIP, though.

  17. primeos commented on Aug 25, 2019

    @primeos
    Member

    So far I have been totally unable to run firefox under wayland natively.

    @NilsIrl Just remembered that I wanted to test this at some point (I'm not using Firefox by default).

    While Firefox from the firefox package does indeed run with XWayland, the one from the firefox-wayland package does run natively under Wayland on my setup (I'm using Sway on nixos-unstable). Maybe it changed in the meantime?

  18. NilsIrl commented on Aug 25, 2019

    @NilsIrl
    Member

    @primeos are you running firefox-wayland on unstable as well?

  19. NilsIrl commented on Aug 25, 2019

    @NilsIrl
    Member

    I can confirm that:

    • stable firefox-wayland
    • unstable firefox-wayland

    do not work (firefox never shows a window and is stuck) where as

    • stable firefox-wayland
    • stable xwayland
    • unstable sway

    does work.

    Also I use sway unstable just because there's a "rendering" bug that's "fixed" (it still occur but is less painful) in it.

  20. primeos commented on Aug 25, 2019

    @primeos
    Member

    @primeos are you running firefox-wayland on unstable as well?

    Yes (nixos-unstable, it wasn't the most recent release (might be 1-2 weeks behind) but hopefully that shouldn't make a difference in this case).

    Firefox never shows a window and is stuck

    That seems like a bug (I though it was just using XWayland instead). Does it print something interesting to the console (when you run it from a terminal)?

    • stable firefox-wayland
    • stable xwayland
    • unstable sway

    That's strange... Does xwayland from stable vs unstable make the difference?

    Also I use sway unstable just because there's a "rendering" bug that's "fixed" (it still occur but is less painful) in it.

    In case it matters (but I guess it shouldn't) I should probably mention that I was using Sway 1.2-rc2 but still with wlroots 0.6.0.

  21. NilsIrl commented on Aug 25, 2019

    @NilsIrl
    Member

    The problem is that without xwayland explicitly installed firefox-wayland will not work.

  22. primeos commented on Aug 27, 2019

    @primeos
    Member

    The problem is that without xwayland explicitly installed firefox-wayland will not work.

    Just tested this and got the same result on my system. It doesn't crash/terminate, doesn't print any warning/error messages to the console, and also doesn't create a window (i.e. it seems to do basically nothing).

    It's probably an upstream bug due to leftovers from X11. strace might help, but I don't have time to investigate this.

    However, with xwayland installed it works and creates a Wayland window as expected (at least the main browser window). It might also need XWayland for something else and I also see the following warning on the console (when XWayland is installed):

    invalid cast form 'GdkWaylandDisplay' to 'GdkX11Display'
    
  23. NilsIrl commented on Oct 23, 2019

    @NilsIrl
    Member

    The problem is that without xwayland explicitly installed firefox-wayland will not work.

    @primeos

    Try to set the following in your $XDG_CONFIG_HOME/sway/config:

    xwayland disable
    

    Tell me if it works

  24. primeos commented on Oct 23, 2019

    @primeos
    Member

    @NilsIrl what's the point of it? No offence, but tbh I neither have much time for it nor am I particularly interested in investigating this any further (I use Chromium instead of Firefox and have XWayland installed -> it doesn't affect me and I cannot easily test it with my current setup).

    I can note the following things though (hope this helps):

    • I think this discussion deserves a separate issue (we're kinda hijacking this thread)
    • I already noted my findings here (XWayland was required but a native Wayland window was created -> I assume it won't work with xwayland disable)
    • The Wayland support in Firefox is probably experimental (source):

      Additionally, problems with Firefox are almost certainly Firefox bugs, not sway bugs. Start by submitting your issue to the Firefox bugzilla and come back here only after they confirm otherwise.

    • You can e.g. use one of the following methods to determine if a window uses Wayland or XWayland: Is an application using Xwayland? (my assumption is that the Wayland support is not complete yet and some parts still require XWayland)
  25. NilsIrl commented on Oct 23, 2019

    @NilsIrl
    Member

    what's the point of it?

    Performance? I read somewhere that Firefox natively on Wayland was smoother. Also there is no Xwayland running in the background.

  26. zimbatm commented on Oct 23, 2019

    @zimbatm
    Member

    Wayland support is complete as far as I am concerned.

    @NilsIrl can you make a separate issue to track the xwayland removal?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: enhancement6.topic: nixos

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions