diff options
author | Kevin Cox <kevincox@kevincox.ca> | 2017-08-05 15:38:48 +0100 |
---|---|---|
committer | zimbatm <zimbatm@zimbatm.com> | 2017-10-23 00:30:47 +0100 |
commit | 5f8cf0048ea089fa73d17512fc4f9f0f0644e225 (patch) | |
tree | 7a9bfc449fab89da9af7b012d4b55ea809eb102d /doc | |
parent | d170c2ceadde34a1ee4844fe59d876351331b707 (diff) | |
download | nixpkgs-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar nixpkgs-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar.gz nixpkgs-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar.bz2 nixpkgs-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar.lz nixpkgs-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar.xz nixpkgs-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.tar.zst nixpkgs-5f8cf0048ea089fa73d17512fc4f9f0f0644e225.zip |
rust: update cargo builder to fetch registry dynamically
The biggest benefit is that we no longer have to update the registry package. This means that just about any cargo package can be built by nix. No longer does `cargo update` need to be feared because it will update to packages newer then what is available in nixpkgs. Instead of fetching the cargo registry this bundles all the source code into a "vendor/" folder. This also uses the new --frozen and --locked flags which is nice. Currently cargo-vendor only provides binaries for Linux and macOS 64-bit. This can be solved by building it for the other architectures and uploading it somewhere (like the NixOS cache). This also has the downside that it requires a change to everyone's deps hash. And if the old one is used because it was cached it will fail to build as it will attempt to use the old version. For this reason the attribute has been renamed to `cargoSha256`. Authors: * Kevin Cox <kevincox@kevincox.ca> * Jörg Thalheim <Mic92@users.noreply.github.com> * zimbatm <zimbatm@zimbatm.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/languages-frameworks/rust.md | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/doc/languages-frameworks/rust.md b/doc/languages-frameworks/rust.md index 481b76fb78f..276b5496fbb 100644 --- a/doc/languages-frameworks/rust.md +++ b/doc/languages-frameworks/rust.md @@ -9,16 +9,15 @@ date: 2017-03-05 To install the rust compiler and cargo put ``` -rustStable.rustc -rustStable.cargo +rust ``` -into the `environment.systemPackages` or bring them into scope with -`nix-shell -p rustStable.rustc -p rustStable.cargo`. +into the `environment.systemPackages` or bring them into +scope with `nix-shell -p rust`. -There are also `rustBeta` and `rustNightly` package sets available. -These are not updated very regularly. For daily builds use either rustup from -nixpkgs or use the [Rust nightlies overlay](#using-the-rust-nightlies-overlay). +For daily builds (beta and nightly) use either rustup from +nixpkgs or use the [Rust nightlies +overlay](#using-the-rust-nightlies-overlay). ## Packaging Rust applications @@ -38,7 +37,7 @@ buildRustPackage rec { sha256 = "0y5d1n6hkw85jb3rblcxqas2fp82h3nghssa4xqrhqnz25l799pj"; }; - depsSha256 = "0q68qyl2h6i0qsz82z840myxlnjay8p1w5z7hfyr8fqp7wgwa9cx"; + cargoSha256 = "0q68qyl2h6i0qsz82z840myxlnjay8p1w5z7hfyr8fqp7wgwa9cx"; meta = with stdenv.lib; { description = "A utility that combines the usability of The Silver Searcher with the raw speed of grep"; @@ -50,7 +49,7 @@ buildRustPackage rec { } ``` -`buildRustPackage` requires a `depsSha256` attribute which is computed over +`buildRustPackage` requires a `cargoSha256` attribute which is computed over all crate sources of this package. Currently it is obtained by inserting a fake checksum into the expression and building the package once. The correct checksum can be then take from the failed build. @@ -76,11 +75,11 @@ in the `~/.config/nixpkgs/overlays` directory. The latest version can be installed with the following command: - $ nix-env -Ai nixos.rustChannels.stable.rust + $ nix-env -Ai nixos.latest.rustChannels.stable.rust Or using the attribute with nix-shell: - $ nix-shell -p nixos.rustChannels.stable.rust + $ nix-shell -p nixos.latest.rustChannels.stable.rust To install the beta or nightly channel, "stable" should be substituted by "nightly" or "beta", or |