CLI to Plasma Installation Docs or Help?

I initially wanted to use the Graphical Live CD to create a NixOS instance in VirtualBox, but ended up swapping out a Fedora Server install for NixOS command line install, due to limitations with the partitioning features. Now I want to get Plasma up and running, but the documentation on how to do this seems to be scant to non-existent. There used to be a page on the old wiki, but that seems to have disappeared.

I followed the instructions in the manual Section X11 and then decided to install plasma-desktop hoping it would install all the needed dependencies and none of the KDE apps. The install was a success, but when I try to run the startup command described in the manual:

systemctl start display-manager.service

I receive the following error message:

Failed to start display-manager.service. Unit display-manager.server not found.

  • So I’m guessing there might be more configuration to do, but I don’t know what. Anyone know how to fix that?
  • I’ve done this all as root. Should I be?
  • Since attempting this, I’ve seen others including package names in environment.systemPackages. Is this perhaps the correct mechanism for installing something like Plasma system-wide?

While the NixOS Manual references environment.systemPackages quite a lot, it doesn’t actually have a dedicated section/sentence describing its purpose, or what sort of packages should be added to the declaration. I see people adding Firefox within it, and that strikes me as quite odd. I wouldn’t describe Firefox as system software.

  • Will NixOS download and install the packages declared in that section, or do I have to manually install them to ensure they are present before the OS loads?
  • Does anyone know what packages are required for a minimal install of plasma desktop?

Any guidance would be greatly appreciated.

Did you set up a display manager as well? I am currently not using Plasma, but this worked before:

  services.xserver = {
    enable = true;
    desktopManager.plasma5.enable = true;
    displayManager.sddm.enable = true;

Yeah that’s what I’ve got:

services.xserver.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.displayManager.sddm.enable = true;
services.xserver.autorun = true;

I’ve also tried without using the SDDM display manager because the documentation states:

NixOS’s default display manager (the program that provides a graphical login prompt and manages the X server) is LightDM.

Which I assume infers you don’t have to explicitly define a display manager. But that didn’t have any effect on this issue either.

My install just boots straight into the command line with a login prompt, no matter what I see to change. The correct place to change these settings is in /etc/nixos/configuration.nix, is it not?

Those are the lines I used too (less services.xserver.autorun = true, since that’s already the default), and SDDM starts up automatically for me. I wonder if something else in your configuration.nix is overriding these options? If you didn’t mind, it might be helpful to post more of your configuration.nix (less anything sensitive, of course).

To answer your questions about environment.systemPackages, this is an array that defines additional packages that get made available to users (and installed, if necessary) beyond what gets pulled in because of the options you’ve set. So, I have the following bit in my configuration.nix to enable a graphical environment:

services.xserver = {
  enable = true; # Actually enables the GUI
  displayManager.sddm.enable = true; # Enables SDDM
  desktopManager.plasma5.enable = true; # Enables a bare-bones Plasma desktop
  desktopManager.xterm.enable = false; # Gets rid of the bare XTerm session
  libinput.enable = true; # Better touchpad support

This gets me a very bare bones Plasma environment after logging in: Dolphin, Konsole, a couple of system tools. That’s it… There’s not even a web browser. So I add a few additional bits:

environment.systemPackages = with pkgs; [
  # Etc.

(Note that you can’t add fonts this way; you need to use the similar fonts.fonts.)

You can also install packages by hand using nix-env, and it’s also possible to have some set of packages for your system (defined in configuration.nix) and then install additional packages just for your user. For example, I have my main system on the stable channel and most of my packages defined in environment.systemPackages in my configuration.nix, but then my normal user is on the unstable channel and I cherry-pick a few packages I want more recent versions of from there. Other folks have different approaches.

Thanks for all the information! Especially about systemPackages. What I did was use the graphical install CD. Created a non-UEFI partition setup. I still don’t really know how I need to arrive at that. Typically when I’ve installed Linux on my MacBook Air, I’ve done fine with UEFI, but GRUB wouldn’t install when I tried a UEFI configuration with VirtualBox. That was one issue I had. I never could get the command line installed instance to upgrade to using Plasma by installing plasma-desktop or declaring it in the configuration.nix.

What has worked though, is putting plasma-desktop in the configuration.nix before actually performing the installation. Then it worked. Now I just need to get my screen resolution sorted. Thanks for your reply.

Huh. Putting plasma-desktop in environment.systemPackages shouldn’t be necessary to get Plasma running. Did you run nixos-rebuild switch after editing configuration.nix previously? Changes don’t go live until after a rebuild.

I don’t have any tips for getting GRUB to work on a MacBook Air with UEFI (IIRC, Macs have some non-standard things going on with their UEFI setup), but I was previously able to use GRUB with UEFI on my System76 laptop using the below:

boot.loader.grub = {
  enable = true;
  device = "nodev";
  efiSupport = true;
  efiInstallAsRemovable = true;

I’ve since switched to systemd-boot (as there’s work going on right now to make NixOS support secure boot with that setup), which is a lot simpler to configure:

boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.enable = true;

I think this is why I couldn’t get it to work on the command line instance. *puts on the dunce hat *

Desperate times lead to desperate measures. :-/ I’ll take it out then.

Now I just have situation where virtualisation.virtualbox.guest.enable = true' seems to have no effect. If I try to change my screen resolution, Plasma redraws the desktop over my entire screen, and then it immediately shrinks back to 800x600.