After having watched the question on SO for nearly 2 weeks now, I am kind of curious how you managed to not get downvoted much, as the question in prose is quite different from what to expect when reading the subject…
Anyway…
- what is the difference?
The difference between path
and git+file
is quite obvious… path
just treats the full filesystem location as the base of the flake, git+file
tries to read the flakes content from a git repository. This is explained in the manual. https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#types which has already been linked.
- what is
self-contained
/hermetic evaluation
?
In quite simple terms, this means, that everything required is included, a declared input or by definition always available.
So a US military MRE is “self-contained” as you just need to add some tap-water and due to some chemical reaction in the outer bag, it will heat up the contents of the inner bag. Tap-water is considered to be always available.
A can of beans though is not self contained, as you require to have a can opener and a camp fire.
git-flake-evaluation
ishermetic
, but ispath-flake-evaluation
hermetic
?
Yes, both are hermetic and pure. But a git-type is easier to send and reason about, and to check if you are really looking at the same code.
- does
nix build git+file:.
have some additional caching, thatnix build path:.
doesnt have?
Yes. Evaluation cache can only work on “snapshottable” flake types.
- why not make
nix build .
just equal tonix build path:.
, instead of thisfind type automatically
behavior, described above (Because: what problem its trying to solve? The problem, solutions to which require all these weird behaviors, like unsolicitedgit add
behind the scenes? But I can easily get around/silence it withpath:.
? This design is so weird, reason is so shady)
To avoid surprises when you share your code. In general defaulting to the version control system is sane, as one can assume that you want to use the version control to share your code.