Broken nix store: path starts with illegal character '.'

Hi,

New day, new issues with my nix config… On one of my hosts, I’m not able to collect gc with nix store gc nor with nix-store --gc to free disk space. I get an error about a store path that starts with a ‘.’:

error: store path 'cs74sfzv3sl8f3inld88nl5d8520699r-.gitconfig' starts with illegal character '.'

After a quick search, I found this topic that seems to be the exact same problem. However I’m not sure how to apply the solution. It says I must change the nix.package option to pkgs.nixVersions.git, however my config is built from flake, so my nix.package is set to pkgs.nixFlakes. Should I still change it ? What is the effect of this option ? I have not been able to find any documentation about it or the values it could take.

I saw on this PR that the nix store daemon version could be the cause of such a bug. I recently updated my system flake inputs to 24.05 but I still see store in version 2.18.2 with nix store ping. Am I missing something about how to update correctly a flake based system ?

Thanks for your time,
JM445

That option just sets the nix package that will be used. It can take any derivation, though you’ll probably break your system if you put a derivation in there that doesn’t build a nix capable of evaluating your config (though booting a different generation with grub/systemd-boot should always still work).

The intended values are any of the packages you can find in pkgs.nixVersions.*, as well as the various aliases set in the upstream aliases.nix (I still find it annoying that those don’t show on search.nixos.org, but that’s a rant for another time).

pkgs.nixFlakes at this point is just an alias to the normal stable nix: nixpkgs/pkgs/top-level/aliases.nix at 89c49874fb15f4124bf71ca5f42a04f2ee5825fd · NixOS/nixpkgs · GitHub

It was originally added when the current stable nix didn’t have support for flakes yet, and upgrades caused some regressions, but that hasn’t been the case for a good year or so now.

Moving to unstable/git shouldn’t cause flake support to disappear, in either case you still need to enable the experimental flag, which you will already be doing if you’re using flakes.

That’s up-to-date afaik. Any other reason you suspect you might not have properly updated?

Actually, on the PR I mentionned earlier, someone seems to have fixed the issue by updating NixOS, and he says it’s store daemon version after update is 2.21.0

I will give a try to the nix.package change.

EDIT: nix.package change worked, it updated the nix daemon to 2.23.0

They must be running NixOS unstable then.

Either way, shouldn’t be a problem from here on; consider switching back to nix stable when the patch for this lands there :slight_smile:

What change did you make with nix.package ? Did you updated it to follow the unstable packages ?

Yes, i set it to nix.package = pkgs.nixVersions.git then a rebuild and the store is fixed

Thank you for the precision!