edolstra / import-cargo Goto Github PK
View Code? Open in Web Editor NEWA function for fetching the crates listed in a Cargo lock file
A function for fetching the crates listed in a Cargo lock file
$TMPDIR
is /build
in the hook, but not in the shell (where it's /tmp/nix-shell.*
usually). This means CARGO_HOME
is set to something non-existent.
Currently import-cargo
just builds a derivation full of vendored source code.
It'd be quite amazing if it could build a set of derivations that compile each dependency separately (in order to avoid recompiling things unnecessarily).
Currently cargo
(nightly) provides --build-plan
, which outputs a plan full of the relevant rustc
calls/args/env variables and the dependency tree. It seems like it should be possible to use this to create the set of nix derivations (with a little bit of rewriting of paths and -L inputs etc.)
A snip of a bit of the --build-plan
output for a single dependency in the middle of my tree:
{
"package_name": "syn",
"package_version": "0.11.11",
"target_kind": [
"lib"
],
"kind": "Host",
"compile_mode": "build",
"deps": [
1,
3,
2
],
"outputs": [
"/home/darius/whist-rust/target/release/deps/libsyn-45a26153f0636545.rlib",
"/home/darius/whist-rust/target/release/deps/libsyn-45a26153f0636545.rmeta"
],
"links": {},
"program": "rustc",
"args": [
"--crate-name",
"syn",
"/home/darius/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-0.11.11/src/lib.rs",
"--error-format=json",
"--json=diagnostic-rendered-ansi,artifacts",
"--crate-type",
"lib",
"--emit=dep-info,metadata,link",
"-C",
"opt-level=3",
"-C",
"debuginfo=2",
"--cfg",
"feature=\"default\"",
"--cfg",
"feature=\"parsing\"",
"--cfg",
"feature=\"printing\"",
"--cfg",
"feature=\"quote\"",
"--cfg",
"feature=\"synom\"",
"--cfg",
"feature=\"unicode-xid\"",
"--cfg",
"feature=\"visit\"",
"-C",
"metadata=45a26153f0636545",
"-C",
"extra-filename=-45a26153f0636545",
"--out-dir",
"/home/darius/whist-rust/target/release/deps",
"-L",
"dependency=/home/darius/whist-rust/target/release/deps",
"--extern",
"quote=/home/darius/whist-rust/target/release/deps/libquote-103bc26133e54dfe.rmeta",
"--extern",
"synom=/home/darius/whist-rust/target/release/deps/libsynom-5d0d6e9fb7bedce0.rmeta",
"--extern",
"unicode_xid=/home/darius/whist-rust/target/release/deps/libunicode_xid-528627904f457e26.rmeta",
"--cap-lints",
"allow"
],
"env": {
"CARGO": "/nix/store/akbsvnqdzj1rspmicv1j8qs8l7rhwbjv-rust/bin/cargo",
"CARGO_MANIFEST_DIR": "/home/darius/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-0.11.11",
"CARGO_PKG_AUTHORS": "David Tolnay <[email protected]>",
"CARGO_PKG_DESCRIPTION": "Nom parser for Rust source code",
"CARGO_PKG_HOMEPAGE": "",
"CARGO_PKG_NAME": "syn",
"CARGO_PKG_REPOSITORY": "https://github.com/dtolnay/syn",
"CARGO_PKG_VERSION": "0.11.11",
"CARGO_PKG_VERSION_MAJOR": "0",
"CARGO_PKG_VERSION_MINOR": "11",
"CARGO_PKG_VERSION_PATCH": "11",
"CARGO_PKG_VERSION_PRE": "",
"LD_LIBRARY_PATH": "/home/darius/whist-rust/target/release/deps:/nix/store/pk26s5n6myxda66splfnvbbg2kw0g40n-rust-1.42.0-nightly-2020-01-01-1ed41b072/lib:/run/opengl-driver/lib"
},
"cwd": "/home/darius/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-0.11.11"
},
Hi!
I would like to use import-cargo in my project under MIT license, but there is no license in this project.
Can you add it?
Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.