diff --git a/hosts/caesar/default.nix b/hosts/caesar/default.nix index d84f8bf..4f96f8d 100644 --- a/hosts/caesar/default.nix +++ b/hosts/caesar/default.nix @@ -14,8 +14,13 @@ in { boot = { initrd.supportedFilesystems = ["ext4"]; - kernelPackages = lib.mkOverride 0 pkgs.linuxPackages_latest; + + loader.grub = { + efiSupport = true; + efiInstallAsRemovable = true; + device = "nodev"; + }; }; programs.zsh = { diff --git a/hosts/caesar/virt.nix b/hosts/caesar/virt.nix index 26ac384..ab850b2 100644 --- a/hosts/caesar/virt.nix +++ b/hosts/caesar/virt.nix @@ -1,15 +1,36 @@ { - config, modulesPath, + config, + pkgs, ... -}: { +}: let + # https://unix.stackexchange.com/questions/16578/resizable-serial-console-window + resize = pkgs.writeScriptBin "resize" '' + if [ -e /dev/tty ]; then + old=$(stty -g) + stty raw -echo min 0 time 5 + printf '\033[18t' > /dev/tty + IFS=';t' read -r _ rows cols _ < /dev/tty + stty "$old" + stty cols "$cols" rows "$rows" + fi + ''; +in { imports = [(modulesPath + "/virtualisation/qemu-vm.nix")]; + environment = { + systemPackages = [resize]; + loginShellInit = "${resize}/bin/resize"; + }; + virtualisation = { memorySize = 8000; diskSize = 200000; cores = 8; + # Try to make this bootable. + useBootLoader = true; + # fs useDefaultFilesystems = false; rootDevice = "/dev/disk/by-label/NIXOS_ROOT"; @@ -25,6 +46,9 @@ vm0.vlan = 1; }; + # The VM will run on a headless machine. + graphics = false; + # mac addr can be anything, especially the last 3 bytes # the OUI is specific to QEMU qemu.networkingOptions = [