diff options
Diffstat (limited to 'nixpkgs/doc/languages-frameworks/rust.section.md')
-rw-r--r-- | nixpkgs/doc/languages-frameworks/rust.section.md | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/nixpkgs/doc/languages-frameworks/rust.section.md b/nixpkgs/doc/languages-frameworks/rust.section.md index 231cbe900e7d..8f6db28ab4d6 100644 --- a/nixpkgs/doc/languages-frameworks/rust.section.md +++ b/nixpkgs/doc/languages-frameworks/rust.section.md @@ -19,6 +19,8 @@ or use Mozilla's [Rust nightlies overlay](#using-the-rust-nightlies-overlay). Rust applications are packaged by using the `buildRustPackage` helper from `rustPlatform`: ``` +{ lib, rustPlatform }: + rustPlatform.buildRustPackage rec { pname = "ripgrep"; version = "12.1.1"; @@ -32,7 +34,7 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "03wf9r2csi6jpa7v5sw5lpxkrk4wfzwmzx7k3991q3bdjzcwnnwp"; - meta = with stdenv.lib; { + meta = with lib; { description = "A fast line-oriented regex search tool, similar to ag and ack"; homepage = "https://github.com/BurntSushi/ripgrep"; license = licenses.unlicense; @@ -58,13 +60,13 @@ then be taken from the failed build. A fake hash can be used for `cargoSha256` as follows: ``` - cargoSha256 = stdenv.lib.fakeSha256; + cargoSha256 = lib.fakeSha256; ``` For `cargoHash` you can use: ``` - cargoHash = stdenv.lib.fakeHash; + cargoHash = lib.fakeHash; ``` Per the instructions in the [Cargo Book](https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html) @@ -226,8 +228,6 @@ source code in a reproducible way. If it is missing or out-of-date one can use the `cargoPatches` attribute to update or add it. ``` -{ lib, rustPlatform, fetchFromGitHub }: - rustPlatform.buildRustPackage rec { (...) cargoPatches = [ @@ -263,7 +263,7 @@ Now, the file produced by the call to `carnix`, called `hello.nix`, looks like: ``` # Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone -{ lib, stdenv, buildRustCrate, fetchgit }: +{ stdenv, buildRustCrate, fetchgit }: let kernel = stdenv.buildPlatform.parsed.kernel.name; # ... (content skipped) in @@ -292,7 +292,7 @@ following nix file: ``` # Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone -{ lib, stdenv, buildRustCrate, fetchgit }: +{ stdenv, buildRustCrate, fetchgit }: let kernel = stdenv.buildPlatform.parsed.kernel.name; # ... (content skipped) in @@ -480,7 +480,7 @@ stdenv.mkDerivation { rustc cargo # Example Build-time Additional Dependencies - pkgconfig + pkg-config ]; buildInputs = [ # Example Run-time Additional Dependencies @@ -522,7 +522,7 @@ stdenv.mkDerivation { latest.rustChannels.nightly.rust # Add some extra dependencies from `pkgs` - pkgconfig openssl + pkg-config openssl ]; # Set Environment Variables @@ -567,12 +567,13 @@ in the `~/.config/nixpkgs/overlays` directory. Add the following to your `configuration.nix`, `home-configuration.nix`, `shell.nix`, or similar: ``` - nixpkgs = { +{ pkgs ? import <nixpkgs> { overlays = [ (import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz)) # Further overlays go here ]; }; +}; ``` Note that this will fetch the latest overlay version when rebuilding your system. |