-
Notifications
You must be signed in to change notification settings - Fork 89
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
Build kinds support #285
base: master
Are you sure you want to change the base?
Build kinds support #285
Conversation
Passes all the crate2nix tests! |
Been playing around with this in a project of mine and it works great. The one issue I see which I am not sure the best way to fix (whether in Tests/examples/benches that are not the library test, rely on the library itself as a dependency. This is not reflected in the dependency list generated by crate2nix. You can get around this by adding |
kind: target | ||
.kind | ||
.first() | ||
.context("Target shouuld have kind")? |
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.
.context("Target shouuld have kind")? | |
.context("Target should have kind")? |
# TODO (when cargo merges metadata): | ||
# harness | ||
# bench |
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.
Your PR rust-lang/cargo#11847 got closed due to inactivity. Do you still intend to resume this?
@@ -48,15 +48,15 @@ | |||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" | |||
}, | |||
"nixpkgs": { |
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.
👀
@jordanisaacs did you keep tinkering with this? We'd like to build benchmarks with crate2nix for Tvix, so I'm curious to see if I can help out somehow. |
@flokli It was a pretty big change that needs changes in three projects (crate2nix, cargo, and nixpkgs) and it didn't get any reviews so stopped pushing it forward. I would love to see this stuff get merged though. I see the way forward being getting the nixpkgs PR merged first. That needs reviewers which you could help with. Then we can revisit crate2nix and what we need merged into cargo (e.g. what metadata do we need). |
I do need to rebase the nixpkgs commit though. Will try and do it sometime this week. |
Add build kind support (relying on NixOS/nixpkgs#221440). Uses a new parameter
buildKinds
, same as the newbuildRustCrate
parameter. All dependencies will only buildlib
.A breaking change is the removal of the
runTests
option. It is now a tools function,crateWithTest
that handles thebuildKinds
for your when you call it. This is so you can override thetestCrate
derivation with your own version (eg if you only want to two derivations: one with tests + examples + benches, and then the final one).TODO:
Closes: #284 #145