I’m suffering from cognitive overload in Nix. Do you have a quick answer to the question:
Should I be using pkgs.fetchgit or builtins.fetchGit?
More involved background information would be welcome too, for future reference, but in the short term I just need simple, actionable advice on which to use.
Also, is it better to use fetchFrom<service> (e.g. fetchFromGitHub) or just use fetch{g,G}it everywhere?
builtins.fetchGit performs the fetching during eval-time, and is primarily meant for fetching Nix expressions. It also allows for fetching private repositories.
pkgs.fetchgit is for during build-time and outputs a fixed-output derivation. It does not (properly) support fetching private repositories.
Also if you can use the fetchFromXxx (e.g. for github) it’s certainly better. fetchFromGithub will populate meta.homepage if needed, and use the tar zip archive if possible (I guess it’s faster? Also the source says that the hash is more stable with the tar.), and fallback to fetchgit otherwise (for advanced options).