Using binary cache with custom kernel?

Hi,
I have 2 nixos machines, both with the same pinned kernel thanks to this block: Linux kernel - NixOS Wiki.

I’d like to have one machine building it and the other machine installing it from cachix. I can see the 2nd machine is downloading the .drv of this custom kernel from cachix but it’s still building the kernel… any idea why?
I have other custom packages pushed in cachix and I can see that the 2nd machine isn’t re-building but only using the binary cache. I’m thinking this block from the wiki just doesn’t work with binary cache?

Any ideas?

Thanks in advance :slight_smile:

Are all the other inputs the same as well? Eg. Are both machines pinned to the same channel “commit”?

Yes, I even copied over the content of /etc/nixos and just updated minor things like IP and hostname. As I said it works with other custom packages but not the kernel.

Are you using channels? Do you pin them? If not are you really sure both are using the same?

Alternatively, have you tried building somewhere else and then nix copy-store?

What I ended doing was something like this:
NIXOS_CONFIG=$PWD/configuration.nix nixos-rebuild switch --target-host computer2 --use-remote-sudo from computer1 to computer2 and it worked. But when I copy the configuration.nix and all files from computer1 to computer2:/etc/nixos, it still wants to rebuild the kernel and other custom packages. I’m a bit lost on how to debug further.

Might be that you need a kernel module which needs the linux.dev output at build-time. On the builder, that exists of course but it won’t be pushed to cachix.