Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/languages-frameworks/rust.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ package. `cargoHash256` is used for traditional Nix SHA-256 hashes,
such as the one in the example above. `cargoHash` should instead be
used for [SRI](https://www.w3.org/TR/SRI/) hashes. For example:

Exception: If the application has cargo `git` dependencies, the `cargoHash`/`cargoSha256`
approach will not work, and you will need to copy the `Cargo.lock` file of the application
to nixpkgs and continue with the next section for specifying the options of the`cargoLock`
section.

```nix
cargoHash = "sha256-l1vL2ZdtDRxSGvP0X/l3nMw8+6WF67KPutJEzUROjg8=";
```
Expand Down
4 changes: 4 additions & 0 deletions maintainers/scripts/convert-to-import-cargo-lock.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=. -i bash -p "import ./maintainers/scripts/convert-to-import-cargo-lock" nix-prefetch-git

convert-to-import-cargo-lock "$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
106 changes: 106 additions & 0 deletions maintainers/scripts/convert-to-import-cargo-lock/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions maintainers/scripts/convert-to-import-cargo-lock/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "convert-to-import-cargo-lock"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = { version = "1.0.69" }
basic-toml = "0.1.1"
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
16 changes: 16 additions & 0 deletions maintainers/scripts/convert-to-import-cargo-lock/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
with import ../../../. { };

rustPlatform.buildRustPackage {
name = "convert-to-import-cargo-lock";

src = lib.cleanSourceWith {
src = ./.;
filter = name: type:
let
name' = builtins.baseNameOf name;
in
name' != "default.nix" && name' != "target";
};

cargoLock.lockFile = ./Cargo.lock;
}
5 changes: 5 additions & 0 deletions maintainers/scripts/convert-to-import-cargo-lock/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
with import ../../../. { };

mkShell {
packages = [ rustc cargo clippy rustfmt ] ++ lib.optional stdenv.isDarwin libiconv;
}
Loading