Multiple Desktops using home-manager

Currently I have a single user (myself) using my machine. I now want multiple people to use this machine and be able to customize their desktop. I am using GNOME which I define in the configuration.nix.

How do I move the desktop configuration into home-manager so each user can have his own desktop environment?

System info:

nixos-version: 22.05.3961.1404483f453 (Quokka)
gnome-version: 42.2
home-manager: 22.05

Relavent part in configuration.nix

# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable dconf
programs.dconf.enable = true;

services.xserver.displayManager.gdm.enable = true;

# Enable the GNOME Desktop Environment.
services.xserver.desktopManager.gnome.enable = true;

# Exclude some GNOME Packages
environment.gnome.excludePackages = (with pkgs; [
  gnome-tour # intoduction
  gnome-connections # remote desktop
]) ++ (with pkgs.gnome; [
  gnome-music # music app
  hitori # sudoku game
  atomix # puzzle game
]);

In home-manager I set GNOME settings using dconf

Plasma and Gnome basically have to be enabled on the system, they are doing to much stuff behind the curtains. How good they are configurable thorugh HM then depends on some of their internals and how well corresponding HM modules are implemented. I do not use a DE, therefore I can not tell much more than this.

WMs though (at least Xorg ones) can be managed fully through HM when using xsession.enable

A user then has to select an X version of the available session types and log in, then the script that HM put into ~/.xsession will do the rest for you.

This technique does not work when wayland is used on either side.

2 Likes