summaryrefslogtreecommitdiff
path: root/hosts/hyper-v/configuration.nix
blob: 77da89b274cd0a08dd5b454df273016d76ad3b3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  config,
  lib,
  pkgs,
  inputs,
  ...
}:

{
  imports = [
    # Include the results of the hardware scan.
    ./hardware-configuration.nix
    ../../modules/common.nix
  ];

  networking.hostName = "hyper-v";

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  # Hyper-V setup
  virtualisation.hypervGuest.enable = true;
  services.xrdp.enable = true;
  services.xrdp.defaultWindowManager = "xmonad";

  systemd.services.xrdp.serviceConfig = {
    # Remove the --port in the invokation of xrdp (it overwrites the option in the config)
    ExecStart = lib.mkForce "${pkgs.xrdp}/bin/xrdp --nodaemon --config ${config.services.xrdp.confDir}/xrdp.ini";
  };

  services.xrdp.extraConfDirCommands = ''
    substituteInPlace $out/xrdp.ini \
      --replace-fail "port=3389" "port=vsock://-1:3389" \
      --replace-fail "#vmconnect=true" "vmconnect=true" \
      --replace-fail "security_layer=negotiate" "security_layer=rdp" \
      --replace-fail "crypt_level=high" "crypt_level=none" \
  '';

  services.xserver.displayManager.lightdm.enable = false;

  system.stateVersion = "25.11";
}