Xrdp issues on NixOS

Hi All,

I’m running 23.05.3976.32dcb45f66c0 (Stoat) and I’ve not been able to get xrdp to work until I found this config from xrdp configuration cannot easily get access to xsession start scripts · Issue #126265 · NixOS/nixpkgs · GitHub :

{ libs, config, pkgs,lib, … }:
{

services.xrdp.enable = true;
services.xrdp.defaultWindowManager = “${pkgs.writeScript “xrdp-xsession-gnome” ‘’
${pkgs.gnome3.gnome-shell}/bin/gnome-shell &
waitPID=$!
${lib.getBin pkgs.dbus}/bin/dbus-update-activation-environment --systemd --all
test -n “$waitPID” && wait “$waitPID”
/run/current-system/systemd/bin/systemctl --user stop graphical-session.target
exit 0
‘’}”;
}

I’m having a couple of issues with this config:

  1. the screen refresh rate is painfully slow as I can type faster than the refresh rate.

  2. Machine falls into sleep mode even though its set to “High Performance”. When I remote in, the current session terminates as expected. However, when I logout there’s no active session and the machine goes into sleep mode after a while. I believe empty session is the root cause of the problem

Any pointer is greatly appreciated. Thanks in advance!