Hence the more general question: How to override nativeBuildInputs on buildLinux?
(p.s. I decided to make another thread for this here in the development section as it is a rather specific question concerning the build process for the Linux kernel on NixOS. And it might concern others when formulating it this way.)
It looks like pahole isn’t used by anything except the Linux kernel, so you should just be able to git checkout $OLD_REVISION pkgs/development/tools/misc/pahole/ and then nix-build your kernel.
Well yes, but that pahole is passed as a function argument (the whole file is one gigantic function) declared here:
The callPackage ../os-specific/linux/kernel/manual-config.nix {} here is what passes that argument (callPackage is a bit of voodoo wizardry that fills in any missing arguments, using the top-level package set):
So, basically,
You’re unlucky, the kernel-building parts of nixpkgs are… well… a bit tangled. If you’re doing anything out of the ordinary they can be really hard to keep under control. I eventually gave up and wrote my own kernel build expression when I put together ownerboot.
but,
You’re in luck, you can (probably) just roll back the pahole/default.nix expression and everything should just work.
So since I am building my system from a flake, I’d assume I should just use a package overlay for pahole in the nixpkgs.overlays = [ ]; for my system and override the attribute set to take version 1.23? Then buildLinux will just pick it up. At least I will try that later today.
As you can see, besides downgrading pahole itself, I also needed to downgrade libbpf on which pahole version 1.23 depends. So I created another override for this one and made the pahole override depend on its result.
Later when defining my system in my flake the overlay is used like so: