crate2nix: init at 0.8.0

crate2nix is a tool that "generates nix build files for rust crates
using cargo".

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Cole Helbling 2020-11-16 22:16:05 -08:00
parent 01816a4bf1
commit 011ecb8f90
No known key found for this signature in database
GPG Key ID: B37E0F2371016A4C
2 changed files with 49 additions and 0 deletions

View File

@ -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;
};
}

View File

@ -9969,6 +9969,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;