NixOS 101 Course / Section 1: Getting started: install NixOS and live with it
Premium

1.5 Install a desktop and roll back NixOS generations

Lesson 5 of 28 · 8:19

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

Video chapters

  1. 0:00 Installing XFCE and SDDM
  2. 2:23 Rebuilding NixOS and creating a new boot generation
  3. 4:15 Booting into XFCE and rolling back
  4. 5:44 Switching to MATE and comparing generations
Transcript

Installing XFCE and SDDM

0:00 Okay, so in the video before this one, we just installed this NixOS system here and it basically doesn't run anything. We can log in as root and that's about it. Let's install quickly a desktop system and then reboot into that and then we can see how we can kind of change NixOS configuration over time, how to roll back things and have some fun with it. So let's log in as root and what was previously under /mnt is now in the root folder so we can go /etc/nixos/configuration.nix and we are already prepared to install the X server.

0:40 This alone will install the X server and it will be runnable but it wouldn't run anything so we also need some kind of desktop environment. Question is how do we get that? So we still have the installer manual open and the thing is that when you go to the top and look at the index here, you can see how you can install all kinds of different desktop environments. So for example, let's take the XFCE desktop environment that explains that next to the X server we also need those two paths so the desktop manager is kind of the desktop itself and display manager default session XFCE means that we would kind of start XFCE by default.

1:23 That is also not really a login manager. So what we want to do is when the system boots, we get into a login manager. There we can choose the user and choose the desktop environment and then log in and start that. So let's pick XFCE. And then we can say, OK, like this here, services.xserver.desktopManager.xfce.enable=true.

The full transcript comes with the lesson.

About this lesson

Your fresh NixOS system boots into a bare console. In this lesson you add a desktop environment with a few lines of configuration, try a second one, and switch between them from the boot menu. It is the quickest way to feel what NixOS generations and rollbacks mean in practice.

In this video

  • Finding the desktop environment and display manager settings in the NixOS manual
  • nixos-rebuild boot versus switch
  • Booting an older generation and checking that no trace of the newer desktop is left
  • Swapping XFCE for MATE without uninstalling anything

After this lesson

You can change your system without fear because every earlier state is one reboot away.