My laptop froze mid-upgrade, and now I'm getting strange errors

I had to hard-reboot my laptop after it froze mid-upgrade, and ever since, trying to rebuild results in:

jon@jon-laptop ~> sudo nixos-rebuild --upgrade switch
unpacking channels...
error: syntax error, unexpected $end, at /nix/store/jqyphjgc9h4xgfy9ar1jcbkx355qaiks-env-manifest.nix:1:1
error: program '/nix/store/vfahm96nmi8layj9cjwnv3w57xdf3jb4-nix-2.3.4/bin/nix-env' failed with exit code 1

Reverting my configuration.nix to its old state doesn’t seem to matter, so I’m guessing I don’t have a syntax error in my configuration.nix, but rather it’s in some intermediary file. Should I just delete /nix/store/jqyphjgc9h4xgfy9ar1jcbkx355qaiks-env-manifest.nix? I’m reluctant to mess with anything there.

I had to hard-reboot my laptop after it froze mid-upgrade, and ever since, trying to rebuild results in:

jon@jon-laptop ~> sudo nixos-rebuild --upgrade switch
unpacking channels...
error: syntax error, unexpected $end, at /nix/store/jqyphjgc9h4xgfy9ar1jcbkx355qaiks-env-manifest.nix:1:1
error: program '/nix/store/vfahm96nmi8layj9cjwnv3w57xdf3jb4-nix-2.3.4/bin/nix-env' failed with exit code 1

Reverting my configuration.nix to its old state doesn’t seem to matter, so I’m guessing I don’t have a syntax error in my configuration.nix, but rather it’s in some intermediary file. Should I just delete /nix/store/jqyphjgc9h4xgfy9ar1jcbkx355qaiks-env-manifest.nix? I’m reluctant to mess with anything there.

Well, deleting is much safer using nix-store --delete (might not work)

You might benefit from nix-store --verify --check-contents which will discover which of the previously fsync’ed files are damaged, and then Nix will be willing to rebuild/redownload whatever is missing.

Likely culprit libsass: 3.6.1 -> 3.6.3 by danderson · Pull Request #82377 · NixOS/nixpkgs · GitHub