nixpkgs/pkgs/development/interpreters/evcxr/default.nix
Maximilian Bosch e7053a87ad
evcxr: 0.5.3 -> 0.6.0
Since version `0.6.0` the `rust-src` component (or declaring
`RUST_SRC_PATH`) is needed. Just like in `rust-analyzer`, this is solved by
setting `RUST_SRC_PATH` to `rustPlatform.rustLibSrc` for tests and
wrapped executables.

ChangeLog: https://github.com/google/evcxr/blob/v0.6.0/RELEASE_NOTES.md#version-060
2020-11-12 19:41:32 +01:00

39 lines
1.1 KiB
Nix

{ cargo, fetchFromGitHub, makeWrapper, pkgconfig, rustPlatform, stdenv, gcc, Security, cmake }:
rustPlatform.buildRustPackage rec {
pname = "evcxr";
version = "0.6.0";
src = fetchFromGitHub {
owner = "google";
repo = "evcxr";
rev = "v${version}";
sha256 = "sha256-QpUhUE65/IuT/VenziPX6z+CbJswbPPIv/ZnTthZpEU=";
};
cargoSha256 = "sha256-iUzVd4XtD+41yTV/BmqWLenzAUNPfS7vIHm1KfuPe9A=";
RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
nativeBuildInputs = [ pkgconfig makeWrapper cmake ];
buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
postInstall = let
wrap = exe: ''
wrapProgram $out/bin/${exe} \
--prefix PATH : ${stdenv.lib.makeBinPath [ cargo gcc ]} \
--set-default RUST_SRC_PATH "$RUST_SRC_PATH"
'';
in ''
${wrap "evcxr"}
${wrap "evcxr_jupyter"}
rm $out/bin/testing_runtime
'';
meta = with stdenv.lib; {
description = "An evaluation context for Rust";
homepage = "https://github.com/google/evcxr";
license = licenses.asl20;
maintainers = with maintainers; [ protoben ma27 ];
};
}