Describe the bug
nixos-install when run from the installation media doesn't have access to git which makes it unable to resolve builtins.fetchGit expressions in configuration.nix.
To Reproduce
Steps to reproduce the behavior:
nixos-generate-config --root /mnt etc.)./mnt/etc/nixos/configuration.nix so that it refers to builtins.fetchGit { ... } in at least one place.nixos-install --root /mnt and see it fail.Expected behavior
Would be nice if I could build any complex configurations using nixos-install, including ones referring to builtins.fetchGit { ... }.
Screenshots
none
Additional context
If I run nix-env -i git before running nixos-install --root /mnt, the installation succeeds.
Metadata
- system: `"x86_64-linux"`
- host os: `Linux 5.3.7, NixOS, 20.03pre198214.4cd2cb43fb3 (Markhor)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.1`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
Maintainer information:
???
I believe we would have to install git to the installation media profiles.
I've actually noticed this also and it's a nuisance if you use builtins.fetchGit.
happy to do it myself, just that I'm pretty new to nix and probably somebody would need to show me around how these images get generated
@snicket2100 You can add gitFull at https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/base.nix. I'm not sure if we should use the full version of git, or the regular one.
@worldofpeace does it mean that the fact that nixos-rebuild can see git is only because I have it in systemPackackes...? :/
@worldofpeace does it mean that the fact that
nixos-rebuildcan seegitis only because I have it insystemPackackes...? :/
By having git in systemPackages the realized configuration is resultant in a running system having git. In the install media you still have access to nix-env to install a package imperatively.
@worldofpeace hmm but imagine I an not running the installation media but my NixOS machine, not having git in systemPackages. Would fetchGit work if I do nixos-rebuild or not?
@worldofpeace hmm but imagine I an not running the installation media but my NixOS machine, not having
gitinsystemPackages. WouldfetchGitwork if I donixos-rebuildor not?
fetchGit needs the git executable. So it wouldn't work without it.
You can use nix-shell -p git to use nixos-rebuild or nix-env -iA nixos.git.
We discussed in nixos-dev on adding git totthe minimal media https://logs.nix.samueldr.com/nixos-dev/2020-01-21#2991326; and I believe we concluded that we be a bit much.
But it would probably be fine the graphical one.
https://github.com/NixOS/nixpkgs/pull/79098 adding it to the graphical one then
nixos-install without internet... is very strange. I wouldn't even bother doing that.
But if we have internet, we can prefetch git before evaluating configuration. Just like we prefetch Nix before building system.
Since this issue is not yet resolved for minimal image, I'll leave it open.
Hello, I'm a bot and I thank you in the name of the community for opening this issue.
To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.
The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.
If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.
Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.