NixOS using Wayland by default?

The NixOS manual says that X is still the default display system in NixOS. However, when starting an installation system and checking the system information of GNOME, I’m told that at least the installation system is running with Wayland. Is the manual out of date at this point an Wayland is already the default display system used in NixOS? If yes, does this create problems for Xfce users, since, according to my understanding, Wayland support for Xfce isn’t finished yet?

1 Like

NixOS by default allows you to choose your DE/WM/compositor freely.

I’d rather say, Gnome and plasma now default to Wayland rather than X. This is not a choice made by nixos.

2 Likes

Well, NixOS at least has to make a choice regarding what display system (X or Wayland) to install by default. Also, the manual says in the Wayland section: “While X11 […] is still the primary display technology on NixOS, Wayland support is steadily improving”. This suggests that the installer picks X, at least by default, and that Wayland support is not working well yet, both of which seem to be at odds with the installation system using Wayland.

How does NixOS let me choose the display service? Only by editing the configuration or also via the installer? Or, tailored more concretely towards my specific situation: Can I choose Xfce as my desktop environment in the installer, and will this result in an installation that uses X?

2 Likes

NixOS has no display server/DE/WM/compositor by default.
You must select it manually by putting <whatever>.enable in your config file for the corresponding DE or WM or compositor, and you can enable XWayland as well if using a Wayland compositor.
I’ve limited experience with the GUI installer ISOs, I don’t recall which DEs and WMs are available, though I assume XFCE will be there considering how common it’s been historically. Last time I looked at it, there were 7 or so options to choose from.

services.displayManager.defaultSession = "plasmax11"; may help if you want to pin the defaut. This works for KDE at least.

Well, I’m specifically asking about what the graphical installer does. So it’s not about me being able to put this or that into my configuration.nix file (I know that I can do that), but it is about what the graphical installer will do if I select Xfce as the desktop environment to install: will it pick X, will it pick Wayland or will it let me choose. For this first NixOS installation of mine that I have to get working within a short time frame, I explicitly don’t want to write long sections of configuration.nix by hand but want to rely on an official installer getting things right.

3 Likes

The graphical installer just does a very stock GNOME configuration, so it’s not really making the choice about X vs Wayland. GNOME gets shipped with support for both, and then GNOME / GDM decide at runtime which one they want to use (unless you’ve specifically configured it for one or the other). I believe it will choose Wayland on the majority of hardware these days, but probably not all. I’m fairly sure Plasma6 / SDDM behave this way too.

The section of the manual that says X is the primary display technology is probably just a little outdated. Though NixOS does still ship several X-only alternatives that you can choose from, so it’s not exactly black and white.

5 Likes

Well, I want to pick Xfce via the graphical installer. Will I get X then? Xfce with Wayland is still experimental; so I wouldn’t like to get it.

How can GNOME itself choose between X and Wayland? Both have to be installed for this to be possible. Does this mean that the graphical installer will install both, although only one of them is needed, resulting in a bloated installation?

1 Like

That’s due to gnome, not the installer. XFCE does not support wayland, use that if you like.

1 Like

FWIW, Wayland isn’t exactly a separate thing to be installed like the X server is. Each Wayland compositor is its own complete implementation of the Wayland protocols, if I understand correctly. I’m not even 100% whether or not you can build GNOME without support for both of them.

Actually I might be wrong about a lot of this. But I don’t want to spend the time looking through nixpkgs code to figure it out :stuck_out_tongue:

Hmm, I thought I had made it clear what I mean: For GNOME to be able to choose between X and Wayland, both X and Wayland must be installed, as GNOME doesn’t install Nix packages by itself. So, if GNOME will make this choice, as @ElvishJerricco suggested, it must be the case that the installer installs both X and Wayland, which is not a good thing, in my opinion, as you’ll probably want only one of them.

1 Like

I have my doubts that it’s anything more than a negligible amount of bloat tbh.

Any bloat is disgusting.

To come back to my specific question: I run the graphical installer and select Xfce. What will happen? Will I get Xfce and X installed and no Wayland support?

Oh, and I actually thought that one of the nice things about Nix is that you can avoid bloat by being specific about what components you want; the opposite of Snap and friends, so to say. :slightly_smiling_face:

1 Like

If you care about bloat then don’t use a DE, nobody forced you to use GNOME. But nix in general is quite space-hungry. Anyway I feel like this is going off the rails so, good luck.

2 Likes

While the upstream project allows you to control which backend to support, the Nixpkgs package does not really expose this in a convenient way like e.g. Gentoo USE flags would. Fighting bloat has its costs and us maintainers have better things to do.

But Nix is flexible enough to allow you to build the project however you want. You can, for example, disable X server support in Mutter with something like the following overlay:

(final: prev: {
  mutter = (prev.mutter.override {
    # Possibly incomplete.
    libxcvt = null;
    libICE = null;
    libX11 = null;
    libXcomposite = null;
    libXcursor = null;
    libXdamage = null;
    libXext = null;
    libXfixes = null;
    libXi = null;
    libXtst = null;
  }).overrideAttrs (attrs: {
    mesonFlags = attrs.mesonFlags ++ [
      "-Dx11=false"
    ];
  });
})

Just remember that any graphical program will almost certainly depend on both X11 and Wayland libraries to be able to work on either.

2 Likes

Hmm, I would have thought that you specify in the NixOS configuration what display services to use (X, Wayland, or both) and then other software is built depending on that setting.

1 Like

Unlike many other package managers, Nix does not support optional dependencies – doing so would undermine Nix’s goal of dependency completeness. Instead, all dependencies must be determined when evaluating the package’s derivation.

Though, Nix being a programming language does actually allow Nixpkgs packages to accept parameters, which can be used to control dependencies. For example, gtk4.override { x11Support = false; } will produce a variant of GTK 4 package built without X11 support. But implementing, testing and keeping a combinatorial explosion of options maintained is a lot of work for little benefit so we just did not do that in case of GNOME Shell/Mutter.

3 Likes

I knew about the possibility of using function arguments to specify varying dependencies, and this is exactly what my reasoning was based upon. The NixOS configuration could have a setting for the desired display services and other software could use that: the package descriptions would be functions, but the entries in that set of concrete software packages would apply those functions to something derived from the display services setting.

The GTK setting you mention goes in the right direction, I’d say. In fact, I’d expect most GUI applications to not or only very little depend on X or Wayland directly but rather depend on GTK or Qt. From what I understand, it should be possible to strip all those applications from, say, X dependencies mostly by removing the X dependencies of GTK and Qt.

1 Like