fix: use system.modulesTree for disk image VM kernel modules #1170
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Building disk images with
vmWithDiskofails on NixOS 25.11 with:Cause
The
vmTools.overrideinlib/make-disk-images.nixwas using:The issue:
cfg.kernelPackages.kernel.modulespoints back to the kernel package itself (which contains onlybzImageandSystem.map), not to the actual kernel modules package.Further testing gave me this output:
To verify that the issue is due to version 25.11, I checked the 25.05 and 25.11 output to confirm that the
kernel.modulesattribute suddenly points to something.Solution
Use
config.system.modulesTreeinstead, which correctly points to thelinux-X.X.X-modulespackage containing the actual.kokernel module files needed for the VM initrd.Testing
x86_64-linuxchecks passvmWithDiskonow successfully builds and bootsMinimal Reproduction
flake.lock
{ "nodes": { "disko": { "inputs": { "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1746728054, "narHash": "sha256-eDoSOhxGEm2PykZFa/x9QG5eTH0MJdiJ9aR00VAofXE=", "owner": "nix-community", "repo": "disko", "rev": "ff442f5d1425feb86344c028298548024f21256d", "type": "github" }, "original": { "owner": "nix-community", "ref": "latest", "repo": "disko", "type": "github" } }, "nixpkgs": { "locked": { "lastModified": 1746576598, "narHash": "sha256-FshoQvr6Aor5SnORVvh/ZdJ1Sa2U4ZrIMwKBX5k2wu0=", "owner": "NixOS", "repo": "nixpkgs", "rev": "b3582c75c7f21ce0b429898980eddbbf05c68e55", "type": "github" }, "original": { "owner": "NixOS", "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { "lastModified": 1764522689, "narHash": "sha256-SqUuBFjhl/kpDiVaKLQBoD8TLD+/cTUzzgVFoaHrkqY=", "owner": "nixos", "repo": "nixpkgs", "rev": "8bb5646e0bed5dbd3ab08c7a7cc15b75ab4e1d0f", "type": "github" }, "original": { "owner": "nixos", "ref": "nixos-25.11", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { "disko": "disko", "nixpkgs": "nixpkgs_2" } } }, "root": "root", "version": 7 }