nix flake needs git add(?!?)
So I was adding flake.nix
to my go project template at (https://github.com/geekodour/t-base-go) and I was trying to make the shell come up with use nix . --inpure
in the .envrc
. I constantly got hammered with the following error:
getting status of '/nix/store/bid2zdfq3cj5nwj59zgvmz3jz8c7ykmv-source/flake.nix': No such file or directory
So from the error message(it’s super unclear), it seems that it’s trying to look for the flake file in the wrong directory even if it’s right there in the same directory. After some googling I found this discussion. Then I did git add flake.nix
and staged the flak and puff! magic! things started working!
I am still unsure to why staging the file makes things correct. Maybe git, maybe direnv, maybe nix itself. I’ll come back to this later but I am glad I found the solution in like 5mins rather than 5hrs.