Switching desktop enviorments/window manager easily

I am a complete noob in things evolving around NixOS, I am just starting to learn more about it. I come from a background mostly consisting of recently Debian distros, starting with Ubuntu to Pop!_OS, with some dabbling in arch and arch derivatives.

I am a less of a distro hopper and more of a desktop enviorment/window manager hopper personally and a huge fan of customizing and playing around with my desktop. So seeing how NixOS is based on it’s config file would this enable me to finally create my dream setup?

My ideal dream setup should enable me to easily switch to another desktop enviorment/window manager without much hassle and without having left over theming/configuration files scattered across my system, no weird issues themes having left over changes that now mess with my desktop. Would NixOS enable me to simply change out my DE/WM to a different one while keeping all of my other configurations and home folder? I am usually one to prefer to completely delete my system when changing DE/WM usually just to keep ahead of these kinds of problems and enable me to start over on a fresh empty installation, but this gets very tedious and work intensive over time, especially often losing time recovering old customization I want to carry over that are also (due to my fault) undocumented and embedded in some deeper configuration file structure.

I hope my goal is easily understandable and hopefully doable with NixOS. Sorry if this question is too off topic for this forum.


Welcome :grinning:

im a beginner myself, so grain of salt, with everything i say.

Have you heard of home manager? For me it helps to manage my dotfiles and my desktop environment. There is a great video playlist from LibrePhoenix. where LibrePhoenix talks about exactly this( also general nixos setup, flakes, home manager, etc.)

Home manager allows you to create generations for your user files. Its like the nixos configuration generations, but on a user level. So you could setup a generation for hyprland and a different generation for KDE for example. Then you can just switch between those generations without resetting your system. You also can create an config file for each desktop environment and all the packages/programs you want for that. In the hyprland file you can include waybar and wofi, which you wouldnt need for your KDE desktop.

This modular setup can be intimidating at first, but totally worth it imo. You also have the nice benefit that you can do this layer for layer, without being scared of nuking your previous config, because this is located in a different file and you can just jump back to your last home manager generation to get back to the working desktop, if you mess up something. In the linked playlist there is also a video about modularity, which helps making the first steps.

I hope this helps as a first starting point.


Assuming you’re gonna declare all your configs, NixOs should do the job - you can then switch whenever convenient but prolly some caveats and need to further test on your side that all is setup and declared accordingly (anything set manually would be lost when switching)
=> if you’re new to NixOS, expect quite some time to tweak around until you get the state you want but long term maintenance and changes will be much easier to deal with

For testing / experimenting purpose, why not running some VM’s? there’ll be limitations but you’ll keep your “main” environment untouched.

As an example, running NixOS and multiple remote desktop env in VM’s: GitHub - JimJ92120/nixos-remote-desktop-for-lxd: Demonstrate how to build and run a NixOS Desktop as a container for LXD.

I routinely hop between desktop environments and on NixOS it’s actually much easier than on other distros, because by design you don’t have leftovers from DE’s that you end up dropping. Just declare another DE in configuration.nix, sudo nixos-rebuild switch and start testing your new DE. A small annoying detail: “reboot” UI stops working if you switch a DE while running it, so I have to reboot via the command line for the new DE to fully take effect.