Failed to build kernel with Nix Flake

Failed to build kernel with Nix Flake(nixos-rebuild test --flake ‘.#kevin). It gave some infomation.

https://paste.ubuntu.com/p/yRNtZXvRdB/

It seems like some modules are not found. But without Flake(just nixos-rebuild switch), it will skip the missing Kernel modules automatically and build successfully

The configuration is same as

boot.kernelPackages = pkgs.linuxPackage_latest;

The machine is Samsung Chromebook V1.
Is there any solution? And sorry for my poor English.

nixos-rebuild without --flake will not build your flake, but whatever you have in /etc/nixos/configuration.nix using <nixpkgs>, which might point to some other commit or even channel than what you have your flake configured to use.

There is no way you can compare both commands, unless you made sure that both do build the same configuration with the same inputs, which is possible but not easy to achieve.

1 Like

Thanks, I found a PR in connection with the question.

https://github.com/NixOS/nixpkgs/pull/78430