Added fetchTags feature to fetchgit, explicit and clear support for
fetching all tags after the source tree fetch completes. Doing this at
build-time in the fetcher is required for packages that invoke commands
like 'git describe' which require tags, and since the nix store is
read-only by design, it is not possible to git fetch --tags at
activation- or run-time. This feature may have been possible by
specifying a postFetch option including calling git fetch --tags,
however doing so obfuscates the solution to this very real problem.
Explicit support for fetching tags should be a first class citizen just
like fetching other refs.
This allows running code to change the environment before the
nix-prefetch-git script is run. In particular, it allows setting things
like NIX_PREFETCH_GIT_CHECKOUT_HOOK, which allows additional code to be
run before deleting the .git directory.
This also means there's potentially value in performing a deep clone
then removing the .git directory, so remove the assertion that prevents
doing so.
It's become a common pattern to use `rev = "refs/tags/${version}"` rather than
just `rev = version` to ensure that the tag gets fetched rather than a branch
that has the same name. This has so far been done using boilerplate though, so
let's add a simple abstraction to fetch a tag instead.
Some important ones like fetchLFS were missing. See
https://discourse.nixos.org/t/how-to-use-git-lfs-with-fetchgit/55975 for a
documented instance where this confused a user.
This still isn't complete but the remaining ones I felt were rather niche and I
am not familiar enough with them to sufficiently document their purpose or
usage.
The `--replace` argument for `substitute` and `substituteInPlace` was
deprecated in e07a2fab7f. Updating all
references in the nixpkgs manual to use `--replace-fail`.
Setting the image creation timestamp in the image metadata to a
constant date can cause problems with self-hosted container
registries, that need to e.g. prune old images. This timestamp is
also useful for debugging.
However, it is almost never useful to set the filesystem timestamp to
a constant value. Doing so not only causes the image to possibly no
longer be reproducible, but also removes any possibility of
deduplicating layers with other images, causing unnecessary storage
space usage.
Therefore, this commit introduces "mtime", a new parameter to
streamLayeredImage, which allows specifying the filesystem timestamps
separately from "created". For backwards compatibility, "mtime"
defaults to the value of "created".
This patch fixes occurances of writeTextFile invokations with
a destination set but without a leading slash. This would cause
an opaque build time error.
This patch moves the code snippet which is shown as equivalent to the
example into the actual example block.
Visually, it was not easy to parse that the "equivalent" code piece
belonged to the code snippet that was hidden in the example (which is
collapsed by default).
By moving it into the example block, the "equivalent" piece is hidden by
default as well.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>