Unable to rebuild NixOS: `modprobe: FATAL: Module nvme not found in directory`

I’m unable to update because of the following error:

  sudo nixos-rebuild boot --flake .#
[sudo] contraseña para jorge:
building the system configuration...
error: Cannot build '/nix/store/fc96r0jfqz1cn6bx95vyfbhj6imhllwa-linux-6.12.55-modules-shrunk.drv'.
       Reason: builder failed with exit code 1.
       Output paths:
         /nix/store/6l54qa4s7gqwx6bkwhpmfs2zswg48hih-linux-6.12.55-modules-shrunk
       Last 3 log lines:
       > kernel version is 6.12.55
       > root module: nvme
       > modprobe: FATAL: Module nvme not found in directory /nix/store/qbz3f1wqpv5rj7fb5spxgpyv8syjd2gz-linux-6.12.55-modules/lib/modules/6.12.55
       For full logs, run:
         nix log /nix/store/fc96r0jfqz1cn6bx95vyfbhj6imhllwa-linux-6.12.55-modules-shrunk.drv
error: Cannot build '/nix/store/d7l284yx73c27l78vkjw6cx4glbq6257-initrd-linux-6.12.55.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/byw372gpf68493y9smmsd5zf14xknsxv-initrd-linux-6.12.55
error: Cannot build '/nix/store/danzmsjjj6dgqa8hdwifjlc4jk9xqjfc-nixos-system-woody-25.05.20251027.daf6dc4.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/zg94g9viwbxc747vqknfjnpmlc4v3r8m-nixos-system-woody-25.05.20251027.daf6dc4

There isn’t enough information here; we’d need to see your config. But judging by the error, I’m going to guess you’re trying to use linuxPackages from nixos-unstable on a stable version of NixOS. There was a change in the linux kernel nix expressions interface that makes this incompatible. See: Nixos-rebuild failed because of missing modules on kernel

But you shouldn’t need to get your kernel from nixos-unstable; kernel updates are backported to 25.05.

Here is my configuration: system/hosts/woody/configuration.nix · new-eww-bar · Jorge Javier Araya Navarro / puntoarchivos · GitLab

I’m not using nixos-unstable!

Strange. The derivation it’s failing to build is the one that grabs all the initrd’s kernel modules and the modules they depend on from the system’s full set of kernel modules. But if I clone your repo and build your initrd, it succeeds for me:

$ nix build .#nixosConfigurations.woody.config.system.build.initialRamdisk
/nix/store/7m0fb975zm7ra8691pn8a6dd42bbgg1g-initrd-linux-6.12.41

So I can’t reproduce your failure.

suddenly I’m not experiencing the problem either, so I was able to update :O!