nixpkgs/pkgs/development/interpreters/evcxr/default.nix

39 lines
1.1 KiB
Nix

{ cargo, fetchFromGitHub, makeWrapper, pkg-config, rustPlatform, lib, stdenv, gcc, Security, cmake }:
rustPlatform.buildRustPackage rec {
pname = "evcxr";
version = "0.8.1";
src = fetchFromGitHub {
owner = "google";
repo = "evcxr";
rev = "v${version}";
sha256 = "sha256-5YbvPDyGaoKPelLep2tVica08SI7Cyo9SLMnE6dmWe4=";
};
cargoSha256 = "sha256-hqVmNBrvagqhGPWTaBXuY8lULolWIoR5ovEhH5k1tz4=";
RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
nativeBuildInputs = [ pkg-config makeWrapper cmake ];
buildInputs = lib.optional stdenv.isDarwin Security;
postInstall = let
wrap = exe: ''
wrapProgram $out/bin/${exe} \
--prefix PATH : ${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 lib; {
description = "An evaluation context for Rust";
homepage = "https://github.com/google/evcxr";
license = licenses.asl20;
maintainers = with maintainers; [ protoben ma27 ];
};
}