feat: Implement hybrid console mode for workshop VM

This commit is contained in:
2025-08-16 16:27:57 +02:00
parent 1fdf506d7a
commit 2c34741b03
2 changed files with 24 additions and 14 deletions

View File

@@ -197,14 +197,19 @@ isoConfig // {
desktop() { desktop() {
echo "🖥 Starting GUI session..." echo "🖥 Starting GUI session..."
if command -v startx &> /dev/null; then
if [ -z "$DISPLAY" ]; then if [ -z "$DISPLAY" ]; then
startx & startx &
export DISPLAY=:0 export DISPLAY=:0
sleep 3 sleep 3
echo " GUI started. Run 'browser' to open Firefox" echo " GUI started. Check QEMU window or run 'browser'"
else else
echo " GUI already running" echo " GUI already running"
fi fi
else
echo "💡 GUI available in QEMU window (Alt+Tab to switch)"
echo "🖱 Click on QEMU graphics window to use desktop"
fi
} }
help() { help() {

View File

@@ -76,22 +76,27 @@
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
networking.firewall.enable = false; networking.firewall.enable = false;
# Serial console configuration - the RIGHT way # Hybrid console configuration - serial primary, GUI available
boot.kernelParams = [ "console=ttyS0,115200" "console=tty1" ]; boot.kernelParams = [ "console=ttyS0,115200" "console=tty1" ];
# VM specific settings # VM specific settings
virtualisation.memorySize = 4096; virtualisation.memorySize = 4096;
virtualisation.diskSize = 40000; virtualisation.diskSize = 40000;
# Force serial console as primary # Hybrid mode: GUI available but serial console primary
virtualisation.qemu.options = [ virtualisation.qemu.options = [
"-nographic" "-display" "gtk"
"-monitor" "stdio"
]; ];
# Fix the auto-login conflict with mkForce # Fix the auto-login conflict with mkForce
services.displayManager.autoLogin = lib.mkForce { services.displayManager.autoLogin = lib.mkForce {
enable = true; enable = true;
user = "workshop"; user = "workshop";
}; };
# Keep GUI session commands for when GUI is used
services.xserver.displayManager.sessionCommands = ''
${pkgs.xfce.xfce4-terminal}/bin/xfce4-terminal --fullscreen --title="Workshop Terminal" &
'';
}) })
]; ];
}; };