Nixos-rebuild switch on unstable gives `error: getting attributes of path '/nix/store/*-gnumake-4.4.1': No such file or directory`

In my NixOS unstable virtual machine, I ran an update with nixos-rebuild switch --upgrade (as root) and received the error:

error: getting attributes of path '/nix/store/0lrk3s24y2l74zagz13mv0n7yp8zbqzg-gnumake-4.4.1': No such file or directory

Whenever I try to rebuild my system I get this error. Is there a fix for this? I’ve tried installing gnumake with nix-env -i gnumake in the hope it’d create the required directory, but it hasn’t fixed things. My configs are here.

is this the whole error message?

Never do this, btw, nix-env is a terrible tool. Moreover, installing dependencies via nix-env will not work, period.

Here is the full output if that helps:

unpacking 2 channels...
building Nix...
building the system configuration...
unpacking 'https://github.com/NixOS/nixpkgs/archive/882842d2a908700540d206baa79efb922ac1c33d.tar.gz' into the Git cache...
these 35 derivations will be built:
  /nix/store/pnn6w2cdxxkb14abvxrddz45lpvssn3r-nixos-version.drv
  /nix/store/wjrza8l7l89jpbgkaflwxsfpwjv0fa2k-system-path.drv
  /nix/store/1abp6lss6wlvz1fbh6y9m8348pl8d6hy-dbus-1.drv
  /nix/store/1pskadw2cy8ik27rj22p9p1yf5jjglqm-etc-os-release.drv
  /nix/store/294mbgbvvaxagmjl2dz4pqax6yw7s225-etc-pam-environment.drv
  /nix/store/6gaq4p5n1izphy60790nqcig1sp1f3mb-bashrc.drv
  /nix/store/jmq9k825hsdi631fb2py4kvclpgr017b-X-Restart-Triggers-dbus.drv
  /nix/store/k1yp1jrpwm3zw606m1qp70kir4rsbmp2-unit-dbus.service.drv
  /nix/store/6gg8s5r6gkfjbgpmp59cc5l39xzivrzi-user-units.drv
  /nix/store/jac5654yb4lf7zdkapcal6q883g54kvl-options.json.drv
  /nix/store/9q7lnq2zifsvgdgl2c7zg3f9a9wgzq1d-home-configuration-reference-manpage.drv
  /nix/store/fb66vf5zk1pwn10ngwgk322js2ak9c63-dummy-xdg-mime-dirs1.drv
  /nix/store/n9v2vlgsszwd4dykabjzdyy228211f6h-dummy-xdg-mime-dirs2.drv
  /nix/store/iinqqalaa5fq8hnn29fn6g3qclp66ahk-home-manager-path.drv
  /nix/store/k4krrm1773mgahwafa51bi3ifrji4jy6-home-manager-files.drv
  /nix/store/khjl77ml917p82zcgwx0p9p1llij0ppy-activation-script.drv
  /nix/store/8pkmykf2j0v8g3fc97nnw1fqfgpykbjj-home-manager-generation.drv
  /nix/store/aa7kxsraa4fl5b9a32hvl6dnh1cknyzz-boot.json.drv
  /nix/store/d52h44nfnykgwixks5hw5bcm517kf8l8-set-environment.drv
  /nix/store/aj3v06d4f14riw88cy36wfw1wddwqk5c-etc-profile.drv
  /nix/store/cg8fl8zi47x7myixcz5fqjlh8zm9cwg9-user-generators.drv
  /nix/store/chb9ymrswn7ksxal52dcgr8apfcxznlf-unit-home-manager-fusion809.service.drv
  /nix/store/j2wk2m5cpxarh10njcidw381vnfc0jm5-unit-dbus.service.drv
  /nix/store/npkqbsc8llmhfrg5c0wnpch54vc3j1hr-X-Restart-Triggers-polkit.drv
  /nix/store/lkbppl0ff51p4y1g7db1m8ixzgmdqnnl-unit-polkit.service.drv
  /nix/store/j42zkhyqd00jbkzi5wpqrng8jgjl15lk-shutdown-ramfs-contents.json.drv
  /nix/store/nii6gkm0zlrwm9as5nhpzzn5232435ih-unit-generate-shutdown-ramfs.service.drv
  /nix/store/y28vzca2w2h48sgszm3bhz6lf1g5sz21-unit-accounts-daemon.service.drv
  /nix/store/d6jiw0wwarw93yfgwa15l426x7ywbw4p-system-units.drv
  /nix/store/djvi4d9f8lxkk65p6j5kqgbjwgs63ypz-issue.drv
  /nix/store/iszb9dx7wimkbhaypj9qyvwfk5mksjjv-etc-zshenv.drv
  /nix/store/mf6g7l3vm3ynqmwfzxv3qp073kf1dh6k-system-generators.drv
  /nix/store/vw8n77p5ghh0dkyq5pnsbljyzm2mjq0c-system-shutdown.drv
  /nix/store/k76c27agizd8x7mm7hj0vpcy3q78xjv6-etc.drv
  /nix/store/lnq5hl5mlixljal0ifmb7fi6fiflvr61-nixos-system-nixos-vbox-25.05beta747653.799ba5bffed0.drv
these 14 paths will be fetched (4.16 MiB download, 28.93 MiB unpacked):
  /nix/store/nf35c6arwgbny5qv956yb369gp3g7xjl-brotli-1.1.0
  /nix/store/6qshp6mlih60gwrp4qrh03czi11xa5f9-brotli-1.1.0-dev
  /nix/store/8475s4hsn5kx05idkihmjk67qa30dgpq-flatpak-1.16.0
  /nix/store/d3ach7nbbqv3ahjgfqygay8ib94mnkgg-getconf-glibc-2.40-36
  /nix/store/i1vi0brmwq0ck1p7dzmah5shhlqdnza2-libxslt-1.1.42-bin
  /nix/store/k97dnvbjdhg9pl1rib8d0i9mq9jfc3m7-malcontent-0.13.0-lib
  /nix/store/glr17z2jm1ad6hh6mma9awbn21iciwbd-nixos-render-docs-0.0
  /nix/store/590f5svg1n2jcygb5nqp1czk8kdplrfb-python3.12-markdown-it-py-3.0.0
  /nix/store/iiw48hxxxn90269lr6djw9pl454d1580-python3.12-mdit-py-plugins-0.4.2
  /nix/store/lv9gj6mlqkmb37fp23bjxddbqxwp8g1x-python3.12-mdurl-0.1.2
  /nix/store/5ak2x8172xy6hlnjnzdikki6gr1plf35-texinfo-7.1.1
  /nix/store/kjf9ncban9syf9qcpd3pjm0wgxnsqlnz-xdg-desktop-portal-1.18.4
  /nix/store/yn25kyg80bf81kai33k6dixzyc6vavwl-xdg-desktop-portal-gnome-47.2
  /nix/store/wy40h1cwhzd885ssmx8xsdj6jwq9y174-xdg-desktop-portal-gtk-1.15.1
error:
       … while setting up the build environment

       error: getting attributes of path '/nix/store/0lrk3s24y2l74zagz13mv0n7yp8zbqzg-gnumake-4.4.1': No such file or directory

Sounds extremely odd. Try a store repair?

How do I do that? I looked it up and ran sudo nix store repair but it complained I had no flake.nix file.

sudo nix-store --repair --verify --check-contents

Thanks. It fixed the error.