NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.48k stars 12.98k forks source link

create a graphical configuration module which is enabled when wayland and or xserver is enabled #139984

Open Artturin opened 2 years ago

Artturin commented 2 years ago

as wayland gets more popular we will have more issues such as: https://github.com/NixOS/nixpkgs/issues/139546

any ideas for the name?

loafofpiecrust commented 2 years ago

I've been thinking about this as I consolidate my setup under Wayland. Maybe we need a new top-level option. What comes to mind for me is session. Here are a few options that could live there:

doronbehar commented 2 years ago

Duplicate of #102542

Artturin commented 2 years ago

i would like to work on this @jtojnar any opinions about the naming suggested by @loafofpiecrust i think its okay

jtojnar commented 2 years ago

Not sure if we need a new top-level module, rather than just using services as suggested in https://github.com/NixOS/nixpkgs/issues/102542. Also session evokes to me the user session after logging in. But agree that leaving services.xserver is desirable.

Artturin commented 2 years ago

from #102542

adding the services.displayServer namespace which would include xorg and wayland, so that services.displayServer.wayland.enable = true; would enable all required services that need to be enabled in order to make wayland work for example

wayland isn't a display service but a protocol

jtojnar commented 2 years ago

Right, but you cannot use the protocol directly – you need a compositor – and that will be a service or a program.

Artturin commented 2 years ago

how about

modules/services/graphical which would at least have a option that indicates that a gui is enabled, which will solve https://github.com/NixOS/nixpkgs/issues/139546

modules/services/wayland/ where we would move the current wayland gui's like modules/programs/sway.nix

and keep modules/services/xserver

Artturin commented 2 years ago

Also what should be done with kde and plasma which work in wayland and xorg

loafofpiecrust commented 2 years ago

Fantastic @Artturin! @jtojnar We could use top-level services, but I personally think it's very helpful to logically group these related services together into session.graphical or similar. I understand session evoking "after logging in" but the desktop manager is what controls the session and the display manager is also what starts sessions, so it's directly related. I like having the distinction between services and session because sessions like Gnome tend to produce sessions/*.desktop files, act differently than other services, and are often mutually exclusive at runtime (I can't run both Gnome and KDE at once).

I think that my proposed grouping lends itself well to KDE and Gnome which have both wayland and X variants. I might prefer something more generic than desktopManager and windowManager etc (unless those distinctions are useful to others), instead something that encompasses that this is just the top-level program for a user session. Maybe sessions.

Examples: session.graphical.sessions.plasma5, session.graphical.sessions.gnome, along with wayland-only sway at session.graphical.sessions.sway or x11-only i3 at session.graphical.sessions.i3. ~I could live with services.graphical.* as well, but I don't know of any services grouped that way. My understanding is that services should be flat and if we need hierarchy beyond individual services then we resort to a different config attribute.~ (Edit: misread the services.graphical bit, we could use session.graphical.enable too)

Along with that, we could continue to have services.xserver with a reduced definition, and if you write something like session.graphical.sessions.i3.enable = true; then that causes services.xserver.enable = true;. @Artturin The thing with services.wayland is that wayland isn't a service at all, while xserver is. So it would be confusing to me to put that under services.

Artturin commented 2 years ago

FYI there is no such thing as a desktop manager Only display managers such as lightdm Kde and such are desktop environments

loafofpiecrust commented 2 years ago

Well, I guess I agree with you. I just picked up the term from the existing NixOS options services.xserver.desktopManager.*. I find these "desktop manager" / "desktop environment" / "window manager" / "compositor" terminologies unhelpful when we are really talking about whatever program is launched by a session file. That's why I'd rather call the option sessions or similar.

nixos-discourse commented 1 year ago

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

https://discourse.nixos.org/t/dead-keys-on-gnome-uk-keyboard/21451/8