-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
cargo-lock [wip] #5
Conversation
... | ||
}: | ||
let | ||
cargoLock = builtins.fromTOML (builtins.readFile (builtins.elemAt inputPaths 0)); |
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.
@DavHau just thinking out loud here, but I'm thinking that it might make sense to have inputPaths be a dictionary with name keys ? (rather than a list). Relying on the position of an attribute could be error prone ?
Just a thought.
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.
Actually I'm currently thinking about removing the path list and instead only allow to pass one path.
One reason is that pure translators should be callable via nix expression, and there it is simple to specify just one source.
If the source needs extra files, then it can be patched inside the nix expression before handing it to the translator
@@ -13,7 +13,8 @@ | |||
|
|||
def strip_hashes_from_lock(lock): | |||
for source in lock['sources'].values(): | |||
del source['hash'] | |||
if 'hash' in source: |
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.
I think dave just merged that bit
}: | ||
let | ||
cargoLock = builtins.fromTOML (builtins.readFile (builtins.elemAt inputPaths 0)); | ||
parsed = builtins.listToAttrs (map (p: lib.nameValuePair p.name p) cargoLock.package); |
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.
if you are interested in some of the parsing that nixpkgs does on the cargolock, there was recently a PR about some improvements to it. You might be interested.
https://github.com/NixOS/nixpkgs/pull/137303/files
Taking a look at this repo here might be helpful as well: https://github.com/yusdacra/nix-cargo-integration |
in the helix project it's used. It's very well made! |
Hello, I just came across this and I must say I really like the idea! I would be glad to help with anything. Would love to utilize this in nix-cargo-integration, as I was planning to make crate2nix not use IFD, but this seems like a much better idea :) |
@yusdacra We'd love to collaborate with you. |
@yusdacra Are you interested in working on this? In case this needs some more clarification, we can continue discussing in: #16 |
Yes, I would like to work on this. I have some time for this now so I can attempt building something. |
This can be closed now that there is a Cargo lock translator merged. |
@yusdacra And a very very good one at that! Thank you. |
No description provided.