forked from nixops4/nix-bindings-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Add store and util versions getter, add util init #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
nix_store_get_version Nix C API introduction version minimum💡 Result:
nix_store_get_version()is part of the libstore C bindings (src/libstore/c/nix_api_store.h). In the published external C-API docs for Nix 2.17.0,nix_api_store.hexists and documentsnix_store_get_version(), so the minimum Nix version you can rely on for this function is Nix 2.17.0 (2023-07-24). [1][2]Sources:
[1] Nix 2.17.0 external C-API docs file list (shows
nix_api_store.h) — https://pub.yori.cc/nix-c-api-docs/files.html[2]
nix_api_store.h/ libstore docs (showsnix_store_get_version()signature) — https://pub.yori.cc/nix-c-api-docs/group__libstore.html🏁 Script executed:
Repository: DeterminateSystems/nix-bindings-rust
Length of output: 403
🏁 Script executed:
Repository: DeterminateSystems/nix-bindings-rust
Length of output: 9296
🏁 Script executed:
Repository: DeterminateSystems/nix-bindings-rust
Length of output: 3995
🏁 Script executed:
Repository: DeterminateSystems/nix-bindings-rust
Length of output: 852
🏁 Script executed:
Repository: DeterminateSystems/nix-bindings-rust
Length of output: 665
🏁 Script executed:
# Check the build.rs to see the full version cfg setup cat nix-bindings-store/build.rsRepository: DeterminateSystems/nix-bindings-rust
Length of output: 305
🏁 Script executed:
Repository: DeterminateSystems/nix-bindings-rust
Length of output: 62
Add version gate to
get_version();nix_store_get_versionrequires Nix 2.17.0+.The
get_version()function callsnix_store_get_version(), which was introduced in Nix 2.17.0 (2023-07-24). Without a version guard, builds against older Nix versions will fail at link time. Yourbuild.rscurrently emits cfg only for["2.26", "2.31", "2.33.0pre", "2.33"], leaving this function unguarded. Add#[cfg(nix_at_least = "2.17")]to the function, or extend the version list inbuild.rsto include"2.17".🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The minimum version is basically 2.26, at least for the fetchers it is. It may be possible to use this with < 2.17 but afaik, it's not tested nor really supported. Most people are going to be on 2.26 or newer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RossComputerGuy, thanks for clarifying! Since the project's minimum supported version is 2.26, I'd suggest adding#[cfg(nix_at_least = "2.26")]toget_version()for consistency with other version-specific functions likeget_storedir()(line 259). This ensures the function is only available when building against supported Nix versions.✏️ Learnings added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No like, I am pretty sure nix-bindings-rust won't even compile even if we do this. This function has been around for long enough that version compatibility isn't a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RossComputerGuy, understood! You're right—if the project already requires Nix 2.26+ to compile andnix_store_get_version()existed well before that, then adding a version gate here is unnecessary. I appreciate the clarification. The implementation looks good as-is.🧠 Learnings used