Repository navigation
Added fetchTags feature to fetchgit - #411561
Merged
Merged
Conversation
philiptaron
requested changes
May 28, 2025
philiptaron
left a comment
Contributor
There was a problem hiding this comment.
I'm amenable to merge.
Two requests:
- Drop unrelated change to
.gitignore. - Follow commit conventions:
fetchgit: add fetchTags parameter
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.
timblaktu
force-pushed
the
fetchgit-fetchtags
branch
from
May 28, 2025 23:54
807eabb to
95a780a
Compare
Contributor
Author
|
@philiptaron I have rewritten the commit messages on my source branch to follow the project's documented commit convention. Let me know if there's anything else I can/should do. |
philiptaron
approved these changes
May 29, 2025
Contributor
|
I plan on submitting in ~12 hours unless I got a nack from other relevant parties. |
3 tasks done
4 of 13 tasks
nixos-cuda-channel-updater Bot
pushed a commit
to nixos-cuda/nixpkgs
that referenced
this pull request
Dec 3, 2026
When the fetchTags argument was added to fetchgit in 1247031 (pkgs/build-support/fetchgit: add fetchTags parameter, 2025-05-27) / NixOS#411561, there was no easy way to actually use the tags it would fetch unless leaveDotGit was true. That changed with the addition of the postCheckout hook in fc295b1 (fetchgit: take postCheckout to allow collecting revision without leaving .git, 2025-11-27) / NixOS#465497. The postCheckout hook can make use of the tags before the .git directory is removed. To allow this, remove the assertion that prevents using fetchTags without having leaveDotGit be true.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a fetchTags parameter to fetchgit that ensures all tags
are fetched from the remote repository. Tags are sometimes required in projects, e.g. ones that call 'git describe', and since the nix store is read-only by design, it is not possible to git fetch --tags at activation- or run-time without horrendous violations of this principle. 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, and does nothing to improve the usability of nix.
Explicit support for fetching tags should be a first class citizen just like fetching other refs.
The parameter works by running 'git fetch origin refs/tags/:refs/tags/'
after the main fetch operation, ensuring all tags are available.
for version detection during build or runtime.
Things done
Tested on x86_64, nix 25.11, and this branch of my nix config repo, which integrates and uses this PR source fork/branch in the context of this corresponding branch/fork of the nixpkgs-esp-dev repo, where I stumbled into this and other rakes trying to set up an esp32 dev env. This was my first foray this deep into nix packaging and process, and I learned a lot and hope to contribute more in the future.