diff --git a/boot.sh b/boot.sh index 4bdcdfb..adc71ee 100755 --- a/boot.sh +++ b/boot.sh @@ -8,7 +8,11 @@ CDIR=$(readlink -f "$PWD") NIX_DISK_IMAGE=$(readlink -f "${NIX_DISK_IMAGE:-./nixos-riscv.qcow2}") if ! test -e "$NIX_DISK_IMAGE"; then - qemu-img create -f qcow2 "$NIX_DISK_IMAGE" 1024M + size=1024M + qemu-img create -f raw "$NIX_DISK_IMAGE.raw" "$size" + mkfs.ext4 -L nixos "$NIX_DISK_IMAGE.raw" + qemu-img convert -f raw -O qcow2 "$NIX_DISK_IMAGE.raw" "$NIX_DISK_IMAGE" + rm "$NIX_DISK_IMAGE.raw" fi echo "NIX_DISK_IMAGE = $NIX_DISK_IMAGE" diff --git a/flake.nix b/flake.nix index b7ed0a8..a119f39 100644 --- a/flake.nix +++ b/flake.nix @@ -39,7 +39,7 @@ toplevel = nixosconf.config.system.build.toplevel; in pkgs.mkShell { pname = "qemu-shell"; - buildInputs = with pkgs; [ qemu ]; + buildInputs = with pkgs; [ qemu e2fsprogs ]; # Here we tell the run script where to find the system NIXOS_SYSTEM_TOPLEVEL = toplevel; OPENSBI = syspkgs.opensbi-uboot; diff --git a/vm.nix b/vm.nix index 8a30d99..e77b791 100644 --- a/vm.nix +++ b/vm.nix @@ -24,7 +24,7 @@ }; }; - virtualisation.diskImage = null; + #virtualisation.diskImage = null; # FIXME: Broken as rustc injects compressed instructions. # For now we disable it.