From 7beeff8ba92795a004ce3fde11aa6d723d9d7c14 Mon Sep 17 00:00:00 2001 From: Muse Sweep Date: Fri, 23 Oct 2026 23:24:22 +0000 Subject: [PATCH] amd: add KRdp remote desktop (package + user service) Declarative RDP for the amd Framework laptop, as the long-term counterpart to the imperative RustDesk setup: KRdp lives in the config, so it survives rebuilds. - New amd-only host module nixos/hosts/amd-krdp.nix, wired into the amd host's modules in nixos/hosts/default.nix. No other host is touched (verified: the Intel 'nixos' host evaluates with no krdp package or service). - Installs kdePackages.krdp 6.7.5 for user 'user' and enables a systemd user service for krdpserver. nixpkgs at the pinned rev has no NixOS/home-manager module for KRdp (it is only an optional package of the Plasma 6 desktop), so the service mirrors the unit the package itself ships: same name (app-org.kde.krdpserver.service), same After/Restart, WantedBy plasma-workspace.target -- so the System Settings Remote Desktop KCM and this config manage one and the same unit. - No secrets in the repo: RDP users/passwords are set on the machine in System Settings (stored by KWallet); the TLS cert is generated on the machine. Nothing is passed on the krdpserver command line. - No firewall change: the host opens no RDP port; tailscale0 is a trusted interface, so 3389 is reachable over Tailscale only. Verified by nix eval of nixosConfigurations.amd (service + package present, firewall posture unchanged) and of nixosConfigurations.nixos (absent). Not activated on the laptop: lands with the next successful 'just switch' (see issue #656). --- nixos/hosts/amd-krdp.nix | 59 ++++++++++++++++++++++++++++++++++++++++ nixos/hosts/default.nix | 3 ++ 2 files changed, 62 insertions(+) create mode 100644 nixos/hosts/amd-krdp.nix diff --git a/nixos/hosts/amd-krdp.nix b/nixos/hosts/amd-krdp.nix new file mode 100644 index 0000000000..1a5146ac00 --- /dev/null +++ b/nixos/hosts/amd-krdp.nix @@ -0,0 +1,59 @@ +{ pkgs, ... }: +{ + # KRdp -- KDE's native RDP server -- for the amd laptop only. + # + # This is the declarative counterpart to the imperative RustDesk setup: + # RustDesk is the interim remote desktop, KRdp is the one that survives + # rebuilds because it lives here. nixpkgs (pinned) has no NixOS or + # home-manager module for KRdp -- kdePackages.krdp is only an optional + # package of the Plasma 6 desktop module -- so the package and its user + # service are wired by hand below, for user "user" only, via this + # amd-only host module (see nixos/hosts/default.nix). + # + # The unit deliberately reuses the name and contents of the unit the + # krdp package itself ships (share/systemd/user/app-org.kde.krdpserver + # .service, preset-disabled upstream): the Remote Desktop page in System + # Settings starts/stops/enables exactly this unit over D-Bus, so the + # settings toggle and this declaration manage one and the same service + # instead of fighting. WantedBy plasma-workspace.target means it starts + # with the Plasma session and simply never runs in a non-Plasma one. + # + # No secrets in this repo, by design: + # - RDP usernames/passwords are NOT passed on the command line (they + # would land in the world-readable Nix store and process list). They + # are managed on the machine in System Settings -> Networking -> + # Remote Desktop (the KCM ships in this same package) and are stored + # by KWallet, never in the repo. + # - TLS: if no certificate is configured, krdpserver generates a + # temporary self-signed one; the KCM can also generate a persistent + # on-machine pair. Nothing certificate-like is committed either. + # + # One-time on-machine setup (after the switch that lands this): + # 1. Open System Settings -> Networking -> Remote Desktop. + # 2. Add the RDP user and password that clients will connect with. + # 3. Leave the port at 3389. No firewall change is needed or wanted: + # the host firewall opens no TCP ports, but tailscale0 is a + # trusted interface (nixos/abstract/tailscale-autoconnect), so the + # server is reachable over Tailscale only -- never the LAN. + # Until step 2 is done the service runs but has no user that can log + # in, which is the safe default. + home-manager.users.user = { + home.packages = [ pkgs.kdePackages.krdp ]; + + systemd.user.services.app-org.kde.krdpserver = { + Unit = { + Description = "KRDP Server"; + After = [ + "plasma-xdg-desktop-portal-kde.service" + "plasma-core.target" + ]; + }; + Service = { + Type = "exec"; + ExecStart = "${pkgs.kdePackages.krdp}/bin/krdpserver"; + Restart = "on-abnormal"; + }; + Install.WantedBy = [ "plasma-workspace.target" ]; + }; + }; +} diff --git a/nixos/hosts/default.nix b/nixos/hosts/default.nix index 0dcbb1763a..287b2bb504 100644 --- a/nixos/hosts/default.nix +++ b/nixos/hosts/default.nix @@ -53,6 +53,9 @@ in workerUrl = "https://mail.security.cab"; }; } + # KRdp remote desktop for this laptop (user service + package); + # see the file for the one-time on-machine credential setup. + ./amd-krdp.nix ]; }; # amd-server = host {