about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/interpreters/evcxr/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/evcxr/default.nix')
-rw-r--r--nixpkgs/pkgs/development/interpreters/evcxr/default.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/evcxr/default.nix b/nixpkgs/pkgs/development/interpreters/evcxr/default.nix
new file mode 100644
index 000000000000..81200a94aae9
--- /dev/null
+++ b/nixpkgs/pkgs/development/interpreters/evcxr/default.nix
@@ -0,0 +1,41 @@
+{ cargo, fetchFromGitHub, makeWrapper, pkg-config, rustPlatform, lib, stdenv
+, gcc, cmake, libiconv, CoreServices, Security }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "evcxr";
+  version = "0.11.0";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "evcxr";
+    rev = "v${version}";
+    sha256 = "sha256-JziLEsY6kF5UeDt17q/HDrTlNtHj7DWy1tTq3s2eZHE=";
+  };
+
+  cargoSha256 = "sha256-I164eXgc/yiKKskloh6FGYD3bLCLWXaM6uWa01PRDXs=";
+
+  RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
+
+  nativeBuildInputs = [ pkg-config makeWrapper cmake ];
+  buildInputs = lib.optionals stdenv.isDarwin
+    [ libiconv CoreServices 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 ];
+  };
+}