Issues hotplugging external display after system boot

Hey all,

I’m trying to set up my home server via nixos but am having trouble hotplugging in any external display once the server is running. Feels like a possible systems or ordering issue?

I’m able to ssh into the server after boot and all my external facing services are working. When I plug in any external display I get what looks like the end of a boot log, hanging on a message saying ‘[ OK ] reached target Graphical Interface.’ If i try anything further it crashes the display. Opening any tty also crashes it.

With the display plugged in from poweroff, the server boots up into sddm normally and I am able to enter Hyprland without issue.

The hardware is just some intel integrated gpu/cpu.

My graphics.nix is below:

{ inputs, config, pkgs, lib, ... }:
{
    boot.kernelParams = [
        "i915.enable_psr=0"
        "i915.modeset=1"
        "i915.force_probe=*"
        "i915.reset=1"            # Force reset of the GPU
        "i915.fastboot=0"         # Disable fastboot
        "console=tty1"
    ];

    boot.initrd.kernelModules = [ "i915" ];
    boot.kernelModules = [ "i915" ];

     hardware.graphics = {
        enable = true;
        enable32Bit = true;
        extraPackages = with pkgs; [
            intel-media-driver
            vaapiIntel
        ];
    };

    services.xserver = {
        enable = true;
        videoDrivers = [ "intel" "modesetting" ];

        deviceSection = ''
            Option "DRI" "3"
            Option "TearFree" "true"
            Option "AccelMethod" "sna"
            Option "ReprobeOutputs" "true"    # Force output reprobing
            Option "HotplugEvents" "true"     # Enable hotplug events
        '';
    };

    # Essential services
    services.seatd.enable = true;
    security.polkit.enable = true;

    # More aggressive udev rules for display detection
    services.udev.extraRules = ''
        # Force rescan of DP connectors
        ACTION=="change", SUBSYSTEM=="drm", KERNEL=="card[0-9]-DP-*", ENV{HOTPLUG}=="1", \
        RUN+="${pkgs.bash}/bin/bash -c ' \
        ${pkgs.kmod}/bin/rmmod i915 || true; \
        ${pkgs.coreutils}/bin/sleep 1; \
        ${pkgs.kmod}/bin/modprobe i915; \
        ${pkgs.systemd}/bin/systemctl restart display-manager.service \
        '"
    '';
}

The kernel parameters, udev rules and deviceSection are all AI suggestions, happy to get rid of them as they don’t seem to be helping.

Has anybody resolved a similar issue? Let me know if I can provide better diagnostics.