Error when trying to install the nvidia drivers

I am having the same problem. Everything was working fine until I did a rebuild (I wanted to try out Flakes). The rebuild failed, and I was presented a similar message for nvidia-x11-545.29.02-6.1.76.drv.

By the way, I did not manage to pipe the result of nixos-rebuild to a file. I tried with … > output.log and … | tee output.log. It did not work. How can one pipe the output to a file?