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

nixos/sddm: allow running on wayland without xserver enabled #291913

Merged
merged 5 commits into from
Apr 9, 2024

Conversation

SuperSandro2000
Copy link
Member

@SuperSandro2000 SuperSandro2000 commented Feb 27, 2024

Description of changes

I've only ever tested this with #286522, so we are going to wait until that is merged.

Next step would be to move things not related to xserver out of the xserver setting and to something more generic.

Some history irrelevant history to to this: I am thinking about decoupling wayland from xserver since at least September last year motivated by @tanneberger

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@SuperSandro2000 SuperSandro2000 mentioned this pull request Feb 27, 2024
13 tasks
@SuperSandro2000 SuperSandro2000 changed the title Sddm wayland only nixos/sddm: allow running wayland without xserver enabled Feb 27, 2024
@SuperSandro2000 SuperSandro2000 changed the title nixos/sddm: allow running wayland without xserver enabled nixos/sddm: allow running on wayland without xserver enabled Feb 27, 2024
@SuperSandro2000 SuperSandro2000 force-pushed the sddm-wayland-only branch 3 times, most recently from aa4983f to 1f1bb87 Compare February 28, 2024 19:37
@SuperSandro2000 SuperSandro2000 marked this pull request as ready for review February 28, 2024 19:39
@alois31
Copy link
Contributor

alois31 commented Mar 3, 2024

I wonder if the GNOME folks have some useful information on what parts of services.xserver.enable = true are needed for a pure Wayland session, given that GDM/GNOME already lacks the assertion and should support running on Wayland without the X server too.

@alois31
Copy link
Contributor

alois31 commented Mar 3, 2024

For some reason, SDDM now does not start automatically on boot on my machine. Nvm, this is the defaultUnit issue and I misread the module.

@SuperSandro2000
Copy link
Member Author

Discetting the relevant parts out of xserver is as PR description out of scope of this PR and will done later to keep the scope manageable.

@SuperSandro2000
Copy link
Member Author

I wonder if the GNOME folks have some useful information on what parts of services.xserver.enable = true are needed for a pure Wayland session, given that GDM/GNOME already lacks the assertion

That shouldn't be that hard, we basically need the following but in another PR:

hardware.opengl.enable = mkDefault true;
environment.systemPackages = with pkgs; [ nixos-icons xdg-utils ];
xdg = {
  autostart.enable = true;
  icons.enable = true;
  menus.enable = true;
  mime.enable = true;
};
# The default max inotify watches is 8192.
# most apps require a good number of inotify watches,
# the value below is used by default on several other distros.
boot.kernel.sysctl."fs.inotify.max_user_instances" = mkDefault 524288;  boot.kernel.sysctl."fs.inotify.max_user_watches" = mkDefault 524288;
systemd.defaultUnit = "graphical.target";
fonts.enableDefaultPackages = mkDefault true;

should support running on Wayland without the X server too.

I leave that up to the gnome people. If I didn't do a mistake, there should be no change in functionality and all other display manager need to opt into the new things in explicitly.

@alois31
Copy link
Contributor

alois31 commented Mar 3, 2024

That shouldn't be that hard, we basically need the following but in another PR:

hardware.opengl.enable = mkDefault true;
environment.systemPackages = with pkgs; [ nixos-icons xdg-utils ];
xdg = {
  autostart.enable = true;
  icons.enable = true;
  menus.enable = true;
  mime.enable = true;
};
# The default max inotify watches is 8192.
# most apps require a good number of inotify watches,
# the value below is used by default on several other distros.
boot.kernel.sysctl."fs.inotify.max_user_instances" = mkDefault 524288;  boot.kernel.sysctl."fs.inotify.max_user_watches" = mkDefault 524288;
systemd.defaultUnit = "graphical.target";
fonts.enableDefaultPackages = mkDefault true;

Yes, that's what I meant above in one of the comments that's now folded. These are basically required to restore a working system when actually using the functionality of this PR. (The XDG stuff is already enabled by default though.)

I leave that up to the gnome people. If I didn't do a mistake, there should be no change in functionality and all other display manager need to opt into the new things in explicitly.

Oh, I didn't mean that you should change something for GNOME, but that GNOME may already have some things that have been overlooked here because they seem to support running without the X server already.

@SuperSandro2000
Copy link
Member Author

Anyone has an idea why eval-lib-tests fails? It looks really random to me.

@Shawn8901
Copy link
Contributor

as r-ryantm prs also have that issue it seems also quite unrelated to me.

@SuperSandro2000
Copy link
Member Author

Okay, since ofborg was green before the retrigger and this seems to be a general issue, I think we can ignore this right now.

@SuperSandro2000
Copy link
Member Author

SuperSandro2000 commented Apr 9, 2024

Here goes nothing :shipit:

Don't hit me if this goes wrong and please be so kind and send fixes 🙈

@SuperSandro2000 SuperSandro2000 merged commit 4cc6ce4 into NixOS:master Apr 9, 2024
21 checks passed
@philiptaron
Copy link
Contributor

476b8c2 broke my config with a message that services.xserver.displayManager.sessionPackages does not exist.

Found this PR and updated to remove xserver.

@gallexme
Copy link

breaks for me
i only use

              xserver = {
                # Enable the X11 windowing system.
                enable = true;
                # Enable the GNOME Desktop Environment.
                # services.xserver.displayManager.lightdm = {enable = true;
                # greeter.enable = false;

                # };

                displayManager = {
                  gdm = {
                    enable = true;
                    autoSuspend = false;
                  };
                };
                desktopManager.gnome.enable = true;

                # services.xserver.displayManager.autoLogin.user = "moot";
                # Configure keymap in X11

                layout = "us";
                xkbVariant = "";
              };

  services = {
    xserver = {
      # boot.initrd.kernelModules = ["amdgpu"];
      videoDrivers = ["amdgpu"];
      # videoDrivers = [
      #   "modesetting"
      # ];
      xrandrHeads = [
        "DP-2"
        {
          output = "DP-1";
          primary = true;
        }
      ];
      exportConfiguration = true;
    };
  };
  • hyprland
 sudo nixos-rebuild boot --flake .    --show-trace   --max-jobs 2 --keep-going --cores 20  --option eval-cache false
warning: Git tree '/home/moot/dev/depot_space' is dirty
warning: input 'flake-utils' has an override for a non-existent input 'nixpkgs'
warning: input 'mk-shell-bin' has an override for a non-existent input 'nixpkgs'
error:
       … while calling the 'seq' builtin

         at /nix/store/skrr54jsvr8qdsfd1jghmylvbqkcajlp-source/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       … while calling the 'throw' builtin

         at /nix/store/skrr54jsvr8qdsfd1jghmylvbqkcajlp-source/lib/modules.nix:298:18:

          297|                     ''
          298|             else throw baseMsg
             |                  ^
          299|         else null;

       error: The option `services.xserver.displayManager.sessionPackages' does not exist. Definition values:
       - In `/nix/store/skrr54jsvr8qdsfd1jghmylvbqkcajlp-source/flake.nix':
           {
             _type = "if";
             condition = false;
             content = [
               <derivation qtile-wayland-session>
           ...
      repl is also broken any advice? 

@alois31
Copy link
Contributor

alois31 commented Apr 10, 2024

I guess another mkRenamedOptionModule should be added for that setting.

@SuperSandro2000
Copy link
Member Author

Please take a look at #303186

lib.assertMsg (d != null -> (lib.types.str.check d && lib.elem d config.services.displayManager.sessionData.sessionNames)) ''
Default graphical session, '${d}', not found.
Valid names for 'services.displayManager.defaultSession' are:
${lib.concatStringsSep "\n " cfg.displayManager.sessionData.sessionNames}
Copy link
Member

Choose a reason for hiding this comment

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

This PR causes a regression for the assert message:

       error: attribute 'displayManager' missing

       at /nix/store/2arfgnb82dbh6s3h9fv05rxpr4f6z930-source/nixos/modules/services/display-managers/default.nix:125:49:

          124|                 Valid names for 'services.displayManager.defaultSession' are:
          125|                   ${lib.concatStringsSep "\n  " cfg.displayManager.sessionData.sessionNames}
             |                                                 ^
          126|               '';

See line 4:

  cfg = config.services.displayManager;

Copy link
Member Author

Choose a reason for hiding this comment

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

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/enable-plasma-6/40541/24

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/enable-plasma-6/40541/30

trueNAHO added a commit to trueNAHO/stylix that referenced this pull request Aug 20, 2024
Rename the deprecated services.xserver.displayManager.sddm.enable option
to services.displayManager.sddm.enable, following [1].

[1]: NixOS/nixpkgs#291913
trueNAHO added a commit to trueNAHO/stylix that referenced this pull request Aug 21, 2024
Rename the deprecated services.xserver.displayManager.sddm.enable option
to services.displayManager.sddm.enable, following [1].

[1]: NixOS/nixpkgs#291913

Link: danth#513
danth pushed a commit to danth/stylix that referenced this pull request Aug 21, 2024
Rename the deprecated services.xserver.displayManager.sddm.enable option
to services.displayManager.sddm.enable, following [1].

[1]: NixOS/nixpkgs#291913

Link: #513
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cinnamon 6.topic: Enlightenment DE The Enlightenment Desktop Environment 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: Lumina DE The Lumina Desktop Environment 6.topic: mate The MATE Desktop Environment 6.topic: nixos 6.topic: pantheon The Pantheon desktop environment 6.topic: qt/kde 6.topic: xfce The Xfce Desktop Environment 8.has: documentation 8.has: module (update) 10.rebuild-darwin: 0 10.rebuild-linux: 1-10 12.approvals: 3+
Projects
None yet
Development

Successfully merging this pull request may close these issues.