Nvidia-vaapi-driver fails to build after flake update, only successful using live media

i recently converted my nixos system configuration to a flake. when trying to update the flake however, i run into a problem. running nix flake update finishes without problems, but when trying to rebuild the system, it fails to build the nvidia vaapi dependency, with this error:

rebuilding system configuration...
building the system configuration...
error: builder for '/nix/store/42bl9rnbrjhwcl1qd363531aw2ljjghh-nvidia-vaapi-driver-0.0.11.drv' failed with exit code 1;
       last 10 log lines:
       > Version: 1.3.0
       > Source dir: /build/source
       > Build dir: /build/source/build
       > Build type: native build
       > Project name: nvidia-vaapi-driver
       > Project version: 0.1
       >
       > meson.build:1:0: ERROR: Could not invoke sanity test executable: [Errno 2] No such file or directory: '/build/source/build/meson-private/sanitycheckc.exe'.
       >
       > A full log can be found at /build/source/build/meson-logs/meson-log.txt
       For full logs, run 'nix log /nix/store/42bl9rnbrjhwcl1qd363531aw2ljjghh-nvidia-vaapi-driver-0.0.11.drv'.
error: 1 dependencies of derivation '/nix/store/9hvl4aizc6aqqnrry2758bsj9qnlm1qx-opengl-drivers-32bit.drv' failed to build
error: 1 dependencies of derivation '/nix/store/67gc13nj7g0gxwyyaiz9j5lba70i2zc6-steam-run-usr-multi.drv' failed to build
error: 1 dependencies of derivation '/nix/store/7223vzyi7diyrpjhpdj9fj2vkwg227km-steam-usr-multi.drv' failed to build
error: 1 dependencies of derivation '/nix/store/a51w5ww1fg6mqskzrlm0487d9ris6csf-nixos-tmpfiles.d.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5asm7w5x21kyc6c2k8hbnldx6rd0gn2z-steam-fhs.drv' failed to build
error: 1 dependencies of derivation '/nix/store/n7b0nzng5vnrywijimmvkb2ijzpj75j9-steam-run-fhs.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5mwckjnbf37wlsspk38kq8ih56c4kagl-steam-bwrap.drv' failed to build
error: 1 dependencies of derivation '/nix/store/mb10pmwkl4vbcv2ff2slgv0kh74nkyjc-steam-run-bwrap.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hdmb357mx9kyi7819ayvmr0q11999iyl-tmpfiles.d.drv' failed to build
error: 1 dependencies of derivation '/nix/store/1r0yhysiwqb3wl810znx0b3bjqw98aca-etc.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-nvidia-x11-545.29.06-6.1.74.drv-9/NVIDIA-Linux-x86_64-545.29.06/32': Directory not empty
error: 1 dependencies of derivation '/nix/store/nbqdf54f6nkm2d3xivz3n8m21861r92x-steam-run.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ni5a6frphqq07ryqz2l3ziay9qndlrz5-steam.drv' failed to build
error: 1 dependencies of derivation '/nix/store/jdkq6cy0ml8l3ay2zqphgpjxh0q30qg2-nixos-system-battlerig-24.05.20240121.612f972.drv' failed to build

before posting this, i did some googling and i only found one other post regarding vaapi not able to be built, but the poster had a different error it looks like. they found out that the nix store was somehow corrupt and fixed the problem by deleting /nix and reinstalling the system (presumably using the live iso)

i have not tried fully reinstalling my system like that, but booting into the live iso and rebuilding my system using nixos-enter finishes without issue and the new configuration is able to be activated. after a rebuild like that any new rebuilds also work fine (as long as i am not trying to update the flake that is). so if this works, i wouldn’t suspect my nix store being corrupt?

it is really inconvenient having to update my system using live media, so any help resolving this issue or experience with similar problems is appreciated.

thanks in advance :)

My error was exactly like yours. I just couldn’t update but my current system was working normally. If you find another solution instead of delete the whole nix store, please tell me