Skip to content

Instantly share code, notes, and snippets.

@waylandc
Created August 19, 2019 11:16
Show Gist options
  • Save waylandc/ef15dd719c17328f5bc277043af1290c to your computer and use it in GitHub Desktop.
Save waylandc/ef15dd719c17328f5bc277043af1290c to your computer and use it in GitHub Desktop.
nix-shell config for rust/substrate development on macos
let
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
myrust = (nixpkgs.rustChannelOf { date = "2019-05-21"; channel = "nightly"; }).rust.override { extensions = [ "rust-src" "rust-analysis" "rustfmt-preview" ]; targets = [ "wasm32-unknown-unknown" ];};
in
with nixpkgs;
stdenv.mkDerivation {
name = "rust-dev";
buildInputs = [
myrust
rustup
rustracer
openssl
wasm-gc
cmake
pkgconfig
python3
gnuplot
wabt
llvmPackages.clang-unwrapped
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.IOKit
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreServices
];
LIBCLANG_PATH="${llvmPackages.libclang}/lib";
RUST_SRC_PATH="${myrust}/lib/rustlib/src/rust/src";
shellHook = ''
export NIX_CXXSTDLIB_LINK=""
export CARGO_HOME="./.cargo"
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment