nixos-riscv/vm.nix

58 lines
1.1 KiB
Nix
Raw Normal View History

2024-01-19 12:32:06 +01:00
{ config, lib, pkgs, modulesPath, ... }:
# Contains the configuration to make a VM bootable with qemu.
{
imports = [
"${modulesPath}/virtualisation/qemu-vm.nix"
];
boot = {
kernelParams = [ "boot.shell_on_fail" ];
2024-03-04 14:44:49 +01:00
#kernelPackages = lib.mkForce pkgs.linuxPackagesCustom;
2024-01-19 12:32:06 +01:00
consoleLogLevel = lib.mkDefault 7;
initrd.kernelModules = [
"virtio_pci"
"virtio_blk"
"virtio_input"
"9pnet"
"9pnet_virtio"
];
2024-03-04 14:44:49 +01:00
kernelPatches = [ {
name = "qemu";
patch = null;
extraConfig = ''
# For qemu
BLOCK y
BLK_DEV y
DEVTMPFS y
VIRTIO_MENU y
VIRTIO_BLK y
VIRTIO_NET y
EXT4_FS y
# For 9P: https://wiki.qemu.org/Documentation/9psetup
NET_9P y
NET_9P_VIRTIO y
NET_9P_DEBUG y
NET_DEVICES y
NET_CORE y
INET y
NETWORK_FILESYSTEMS y
OVERLAY_FS y
"9P_FS" y
"9P_FS_POSIX_ACL" y
PCI y
VIRTIO_PCI y
PCI_HOST_GENERIC y
'';
} ];
2024-01-19 12:32:06 +01:00
loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
};
}