Finding the `vmlinux` corresponding to the current kernel (flake system)

I set my kernel up with boot.crashDump.enable = 1 to debug a system freeze, and now wanted to know what/where the vmlinux corresponding to my kernel is (this might be required for inspecting the crash).

Kernel bzImage is at: /run/current-system/kernel

For vmlinux the following worked in a nix repl:

> flake = builtins.getFlake(/etc/nixos)
> flake.outputs.nixosConfigurations.<my-system-name>.config.system.build.kernel.dev.outPath

gave me the path to the folder that contains the vmlinux. Just ...build.kernel.outPath gave me the same folder as the one that is linked by /run/current-system/kernel, so this seems to match up.

2 Likes