So, I’m new to nixos and I’m running a configuration based on nix-starter-configs. My config lives in a git repository at /etc/nix-config based on the standard nix-start-configs template.
I uninstalled git by removing it from my config and rebuilding. Now I want to reinstalled git, so I added the git package back to my config - but nixos-rebuild switch is failing:
$ sudo nixos-rebuild switch --flake .
error: getting the HEAD of the Git tree ‘/etc/nix-config’ failed with exit code 1:
error: executing ‘git’: No such file or directory
So, did I just bork my system by removing git and that was a bad idea? Is the best way to recover to rebuild from a config located elsewhere? Is this expected behavior or a bug?
My naïve reading of this is that the nix tool depends on git being available, so it should reference that directly. It shouldn’t pick it up from $PATH either – how do we know that’s the right version of git? So yeah sounds buggy to me.
Curl seems a little different - I would expect that dependency is met explicitly.
If git and/or other VCS systems are truly optional, then it feels like this should ‘fail’ gracefully. So, like, if git isn’t present it should fail to do anything it would do with git - but the core rebuild functionality should still work. Right?
where revision is either the same nixpkgs revision that was used to build the current nix package or maybe some hardcoded, well-known revision in cases, where nix wasn’t built from the official nixpkgs.
It doesn’t have to be nixpkgs specifically. We just need a URL to a downloadable source that can provide git. A fixed revision of nixpkgs makes sense as a default value, but it should be possible to configure it during build (and maybe even at runtime via a config option). You can even leave null as a special value meaning "just use the version on PATH" like it does today.