Fediversity/infra/common/proxmox-qemu-vm.nix
Kiara Grouwstra b50bb442f7
get nix run to build a vm bootable by qemu
```
cp /nix/store/.../nixos.img disk.raw
chmod 0644 disk.raw
qemu-system-x86_64 -enable-kvm -m 2048 -drive
if=virtio,file=./disk.raw,format=raw -bios "$(nix eval --impure --expr
'(import <nixpkgs> { }).OVMF.fd.outPath' | jq -r)/FV/OVMF.fd"
```

Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
2025-09-23 10:44:45 +02:00

62 lines
1.1 KiB
Nix

{ ... }:
{
_class = "nixos";
## FIXME: It would be nice, but the following leads to infinite recursion
## in the way we currently plug `sources` in.
##
# imports = [
# "${sources.nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
# ];
boot = {
initrd = {
availableKernelModules = [
"ata_piix"
"uhci_hcd"
"sd_mod"
"sr_mod"
];
kernelModules = [ "dm-snapshot" ];
};
};
disko.devices.disk.main = {
device = "/dev/vda";
type = "disk";
content = {
type = "gpt";
partitions = {
# mbr = {
# priority = 0;
# size = "1M";
# type = "EF02";
# };
esp = {
priority = 1;
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
priority = 2;
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
}