Closed Bert-Proesmans closed 6 days ago
I don't remember why I've set this option to nullOr ints.positive
. From the commit that added it (https://github.com/NixOS/nixpkgs/commit/310eefffe7a3fbd8054eb79f3a6569c4d0635112) it's clear that null is not handled, so it's probably a mistake.
Just stumbled upon this issue and agree with the analysis here.
Describe the bug
Setting nixos option
virtualisation.disksize
to null, which is legal according to typechecks https://github.com/NixOS/nixpkgs/blob/9e2274928b2467b604cdee4d8831232f097ea7ba/nixos/modules/virtualisation/qemu-vm.nix#L355-L357results in an invalid disk size value passed to
qemu-img create
https://github.com/NixOS/nixpkgs/blob/9e2274928b2467b604cdee4d8831232f097ea7ba/nixos/modules/virtualisation/qemu-vm.nix#L124
Launching the script, aka system build attribute
config.system.build.vm
, will throw an error at the disk creation stage mentioning an invalid argument for the size parameter.Steps To Reproduce
Steps to reproduce the behavior:
machine
with value of basic nixosSystemvirtualisation.diskSize = null;
.#machine.config.system.build.vm
Expected behavior
Launching ./result will create a qcow disk and launch qemu with the machine configuration.
Additional context
I found this bug through changes in nixos-generators. I've created an issue in their repo first, but their changes might be technically correct. REF; https://github.com/nix-community/nixos-generators/issues/306
Notify maintainers
No maintainers list within that nixos module file. Pinging @rnhmjoj as last change author on the type of virtualisation.disksize.
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.