My problem is that when I add the ithc module to extraModulePackages: It is unable to find it (error: undefined variable 'ithc') extraModulePackages = with config.boot.kernelPackages; [ xpadneo ithc ];
I think I need to tell it to find the ithc module in pkgs.unstable instead of the kernelPackages coming from surface specific module but I don’t know how to do that.
I doubt this is trivial, unfortunately. The modules are strictly coupled to their packages, mixing multiple kernel/packages is probably a bad idea. Consider using unstable entirely until your changes stabilize.
The variable you’re grabbing those modules from is boot.kernelPackages, by the way, which in your case will probably be the default kernel.
Perhaps just setting that to a kernel from unstable will fix the problem, but note you’ll be running a kernel nobody else is testing your software with, so I’m not sure this gives you any stability whatsoever.
Looks like the surface config they’re importing builds a custom kernel.
I don’t think it should be as hard as you’re saying. Their problem is simply that adding a pkgs.unstable variable doesn’t magically add new kernel module packages to main nixos kernel module packages.
They should just be able to use config.boot.kernelPackages.callPackage to call the Nix expression out of the unstable repo and add that to extraModulePackages. Maybe something like this would work?
EDIT: Alternatively they could re-import the kernel packages expression from the surface stuff in nixos-hardware using the unstable pkgs and set kernelPackages to that. Though they’ll have to mkForce it since the surface code sets it.
I’m less sure this would work. But if it does, it would recreate kernelPackages using nixos unstable sources and that surface kernel expression, meaning it would include all the kernel packages in unstable.
Shall I ask to the author of the custom kernel derivation to integrate it in the nixpkgs repo ? There are already other custom kernels such as zen and It would avoid the lengthy kernel compilation when I upgrade or garbage collect my store.