diff options
author | Andreas Rammhold <andreas@rammhold.de> | 2020-11-17 22:23:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-17 22:23:27 +0100 |
commit | 48d4b84f40eadeec95bc5ab46a32323f913277d8 (patch) | |
tree | cdd6679853c82597ddb6983365a985a5ee5ed572 | |
parent | 0749c7d68d18d6dfaa81298840e51056af185a21 (diff) | |
parent | 011ecb8f904daf95f238cc594f016f15a97cd7f3 (diff) |
Merge pull request #104027 from cole-h/crate2nix
crate2nix: init at 0.8.0
-rw-r--r-- | pkgs/development/tools/rust/crate2nix/default.nix | 47 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
2 files changed, 49 insertions, 0 deletions
diff --git a/pkgs/development/tools/rust/crate2nix/default.nix b/pkgs/development/tools/rust/crate2nix/default.nix new file mode 100644 index 000000000000..a941d43bb9d8 --- /dev/null +++ b/pkgs/development/tools/rust/crate2nix/default.nix @@ -0,0 +1,47 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, makeWrapper + +, cargo +, nix +, nix-prefetch-git +}: + +rustPlatform.buildRustPackage rec { + pname = "crate2nix"; + version = "0.8.0"; + + src = fetchFromGitHub + { + owner = "kolloch"; + repo = pname; + rev = version; + sha256 = "sha256-pqg1BsEq3kGmUzt1zpQvXgdnRcIsiuIyvtUBi3VxtZ4="; + } + "/crate2nix"; + + cargoSha256 = "sha256-dAMWrGNMleQ3lDbG46Hr4qvCyxR+QcPOUZw9r2/CxV4="; + + nativeBuildInputs = [ makeWrapper ]; + + # Tests use nix(1), which tries (and fails) to set up /nix/var inside the + # sandbox + doCheck = false; + + postFixup = '' + wrapProgram $out/bin/crate2nix \ + --suffix PATH ":" ${lib.makeBinPath [ cargo nix nix-prefetch-git ]} + ''; + + meta = with lib; { + description = "A Nix build file generator for Rust crates."; + longDescription = '' + Crate2nix generates Nix files from Cargo.toml/lock files + so that you can build every crate individually in a Nix sandbox. + ''; + homepage = "https://github.com/kolloch/crate2nix"; + license = licenses.asl20; + maintainers = with maintainers; [ kolloch andir cole-h ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b29cd7a0d5d7..96031ac0a88b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9970,6 +9970,8 @@ julia_15 = callPackage ../development/compilers/julia/1.5.nix { inherit (darwin.apple_sdk.frameworks) Security; }; + crate2nix = callPackage ../development/tools/rust/crate2nix { }; + maturin = callPackage ../development/tools/rust/maturin { }; inherit (rustPackages) rls; rustfmt = rustPackages.rustfmt; |