Due to a setting I enabled (crash dump kernel) doing a nixos-rebuild sometimes needs to rebuild my kernel from scratch, which I would like to make faster by using ccache.
I found the programs.ccache.packageNames option, which allows setting packages that should be built using ccache.
However, this does not actually cause ccache to be used to build the kernel, i.e., CCACHE_DIR="/var/cache/ccache" ccache -s reports an empty/unused cache directory.
What is the correct name to give to programs.ccache.packageNames to enable ccache when my kernel is being built?
(Small extra question: How can I easily test this, i.e., trigger a rebuild of my kernel when it’s not necessary?)
@gytis-ivaskevicius (or at least someone with the same name) on Matrix reminded me that /var/cache/ccache needs to be in my build sandbox, as I’m on flakes. They also found that this seems to be done by other people as well: Sign in to GitHub · GitHub (thanks @gytis-ivaskevicius!)
This would make a lot of sense. Couldn’t test it yet as I don’t know how to rebuild my kernel, any ideas on that?
Yeah that’s what I meant. I had boot.crashDump.enable on true, changed it to false and rebuilt one time, then set it back to true, but that didn’t cause a rebuild (which I guess makes sense). I guess I could run gc after setting it to false?
Just had a system update that included rebuilding the kernel, but it didn’t use ccache (i.e., CCACHE_DIR="/var/cache/ccache" ccache -s still reports an empty cache).
What is the correct package name/would be a way to find the correct package name, as it doesn’t seem to be linux?
The problem here seems to be that the kernel build references buildPackages.stdenv.cc in depsBuildBuild; this needs to be overridden with ccacheStdenv too.