summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
authorRyan Lahfa <masterancpp@gmail.com>2022-12-01 15:16:23 +0100
committerGitHub <noreply@github.com>2022-12-01 15:16:23 +0100
commita8a68c3427632c079667ee8aa37dc6666c6f71fb (patch)
treedddab3b0f10432d31ccfbf17d26804502c1a5498 /nixos
parentcc11eea79decd441d8413d97b3c539df4ed24333 (diff)
parent7f026cc6d02746d553e5e3701d44fc89869bc7af (diff)
Merge pull request #189935 from baloo/baloo/qemu-vm/fixup-efi-partitions
qemu-vm: ensure we do not overwrite the partition table when EFI is in use
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/virtualisation/qemu-vm.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index edc6dfdc15ae..9af7e07ccfba 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -858,7 +858,8 @@ in
# If the disk image appears to be empty, run mke2fs to
# initialise.
FSTYPE=$(blkid -o value -s TYPE ${cfg.bootDevice} || true)
- if test -z "$FSTYPE"; then
+ PARTTYPE=$(blkid -o value -s PTTYPE ${cfg.bootDevice} || true)
+ if test -z "$FSTYPE" -a -z "$PARTTYPE"; then
mke2fs -t ext4 ${cfg.bootDevice}
fi
'';