TL;DR: can I bisect NixOs’s kernel without recompiling it every time?
I just got a regression with my NixOs upgrade, and after reporting the issue, the kernel team asked me to bisect the kernel (to be honest, finding a reliable test to check if the bug is gone might not be easy, but it is another issue)… Bisecting the kernel in NixOs seems to be not too complicated as documented here via:
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux_6_2.override { # (#4)
argsOverride = rec {
src = pkgs.fetchFromGitHub {
owner = "torvalds";
repo = "linux";
# (#1) -> put the bisect revision here
rev = "7484a5bc153e81a1740c06ce037fd55b7638335c";
# (#2) -> clear the sha; run a build, get the sha, populate the sha
sha256 = "sha256-nr7CbJO6kQiJHJIh7vypDjmUJ5LA9v9VDz6ayzBh7nI=";
};
dontStrip = true;
# (#3) `head Makefile` from the kernel and put the right version numbers here
version = "6.2.0";
modDirVersion = "6.2.0-rc2";
};
});
but unfortunately, as far as I understand compiling the kernel can take a fair amount of time (from 30mn to up to several hours ?)…
Would it be possible instead to cache the compilation of the kernel so that next compilations only takes a few seconds? I was thinking to try to use nix-shell
+ run genericBuild
(see e.g. this page) with a custom $out
in /tmp/mykernel
, and then create a custom derivation that just copies /tmp/mykernel
verbatim to $out
… but seems like a bit tedious and dirty. Is there a cleaner way to proceed?