diff --git a/lib/interactive-vm.nix b/lib/interactive-vm.nix index 2ac3df6..f60d156 100644 --- a/lib/interactive-vm.nix +++ b/lib/interactive-vm.nix @@ -55,6 +55,7 @@ in diskoBasedConfiguration ]; + disko.enableConfig = false; disko.testMode = true; disko.imageBuilder.copyNixStore = false; diff --git a/tests/vm-with-disko-swap.nix b/tests/vm-with-disko-swap.nix new file mode 100644 index 0000000..16f6b4c --- /dev/null +++ b/tests/vm-with-disko-swap.nix @@ -0,0 +1,21 @@ +# vmWithDisko must not duplicate swapDevices generated from the disko config. +# Regression test for https://github.com/nix-community/disko/issues/1283 +{ + pkgs ? import { }, + ... +}: +let + lib = pkgs.lib; + system = pkgs.nixos [ + ../module.nix + ../example/swap.nix + { + documentation.enable = false; + system.stateVersion = "26.11"; + } + ]; + vmSwap = system.config.virtualisation.vmVariantWithDisko.swapDevices; + uniqueSwapDevices = lib.unique (map (s: s.device) vmSwap); +in +assert (builtins.length vmSwap == builtins.length uniqueSwapDevices); +pkgs.runCommand "test-vm-with-disko-swap" { } "touch $out"