How do I install a desktop manager and connect via RDP (Or VNC)

I have a NIXOS machine / server installed in a closet which I would like to use as persistent dev workstation regardless of which physical machine I use to connect to it. Therefore, I would like to install a desktop environment and be able to connect to it with an RDP client.

When I installed the nixos server, I opted not to install a desktop environment. I tried adding the following to my configuration.nix.

  environment.systemPackages = [
    ...
    pkgs.gnome.gnome-remote-desktop
    pkgs.xrdp
    pkgs.gnome.gdm
  ];

  services.xserver.enable = true;
  services.xserver.displayManager.gdm.enable = true;
  services.xserver.desktopManager.gnome.enable = true;
 
  services.xrdp.enable = true;
  services.xrdp.defaultWindowManager = "gnome-remote-desktop";
  services.xrdp.openFirewall = true;

I use remmina as a client to connect using RDP. I get the XRDP window asking me to login, but then it just disconnects and closes the remmina window. Am I missing something?

Thanks!

1 Like

In case someone else is trying to do this:

I was able to install the desktop environment remotely just fine. Add the relevant lines to configuration.nix and rebuild switch. However, there were some issues.

  1. Adding a desktop manager may also add power management features that cause your previous headless server to hibernate when previously it would run forever. You can fix this of course, but it was a bit unexpected to have my server drop off the network. I had to plug in monitor to find out what happened.
  2. I could get KDE plasma to work over RDP, but not gnome. I’m not sure why, but I gave up as it wasn’t worth investigating.