Skip to content

Instantly share code, notes, and snippets.

@hermannolafs
Last active December 19, 2024 12:27
Show Gist options
  • Save hermannolafs/c1379a090350d2dc369aeabd3c0d8de3 to your computer and use it in GitHub Desktop.
Save hermannolafs/c1379a090350d2dc369aeabd3c0d8de3 to your computer and use it in GitHub Desktop.
Nixos Gnome RDP Remote Desktop
{
# minimized for clarity.
# Some of these might not be needed. After some trial and error
# I got this working with these configs.
# I do not have the patience to rn an elimination test.
services.gnome.gnome-remote-desktop.enable = true;
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xrdp.enable = true;
services.xrdp.defaultWindowManager = "${pkgs.gnome3.gnome-session}/bin/gnome-session";
services.xrdp.openFirewall = true;
environment.systemPackages = with pkgs; [
gnome3.gnome-session
];
# Open ports in the firewall.
networking.firewall = {
enable = true;
allowedTCPPorts = [ 3389 ];
allowedUDPPorts = [ 3389 ];
};
}
@sstratoti
Copy link

Thanks for this! It helped get me going with gnome xrdp in nix!

@jamesbrink
Copy link

Wow thank you so much for this! idk why i had so much trouble with this initially but this worked. I would add thing, if you have just a single user make sure you disable autologin, otherwise it gets angry at least with gnome/gdm

services.displayManager.autoLogin.enable = false;

@David-Kopczynski
Copy link

For some reason I had trouble getting any configuration to run. However, upgrading from x11 to wayland magically fixed all my problems. For anyone wondering, the minimal gnome config I am using is:

{ pkgs, ... }:

{
  environment.systemPackages = with pkgs.gnome; [ gnome-remote-desktop ];
  services.gnome.gnome-remote-desktop.enable = true;

  services.xrdp.enable = true;
  services.xrdp.defaultWindowManager = "${pkgs.gnome.gnome-session}/bin/gnome-session";
  services.xrdp.openFirewall = true;
}

as described in https://nixos.wiki/wiki/Remote_Desktop#GNOME.

Please note, that the gnome-connections is not working perfectly either... I recommend remmina.

@alexwaibel
Copy link

Thanks for this, was a big help! I can only seem to get this working with the gnome-session from gnome3 as in the original gist. If I try to use gnome-session from regular gnome package I get a black screen on login.

Can confirm you don't need to set the allowed ports manually though, services.xrdp.openFirewall = true; takes care of that.

@hellconnon
Copy link

hellconnon commented Dec 19, 2024

Have to add that this nearly works as of now.
You have to use the gnome-session package from nixpkgs directly (not gnome.gnome-session nor gnome3.gnome-session).
If you encounter a black screen read the official docs on remote desktop carefully, you have to be logged out from any other session to start a remote desktop session.

@David-Kopczynski
Copy link

Yes, as of release 24.11 gnome. was removed from all packages 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment