diff --git a/dfx.nix b/dfx.nix index a42d0ba6c1..1db6a57989 100644 --- a/dfx.nix +++ b/dfx.nix @@ -28,7 +28,11 @@ let ''cargo $cargo_options test $cargo_test_options --workspace --exclude ic-agent'' ''RUST_TEST_THREADS=1 cargo $cargo_options test $cargo_test_options -p ic-agent'' ]; - static = pkgs.stdenv.isLinux; + override = oldAttrs: { + # both needed for bindgen, used by rocksdb-sys, zstd-sys, lmdb-sys, etc + LIBCLANG_PATH = "${pkgs.llvmPackages.libclang}/lib"; + CLANG_PATH = "${pkgs.llvmPackages.clang}/bin/clang"; + }; }; # add extra executables used when linting @@ -94,13 +98,24 @@ let }; }; + # Note that on Linux we need the static environment. + cc = if pkgs.stdenv.isLinux + then pkgs.pkgsStatic.stdenv.cc + else pkgs.stdenv.cc; + # fixup the shell for more convenient developer use fixShell = ws: ws // { shell = pkgs.mkCompositeShell { name = "dfinity-sdk-rust-env"; - nativeBuildInputs = [ pkgs.rls ]; + nativeBuildInputs = [ + pkgs.rls + # wabt-sys needs file in path, as well as cc (for cmake). + pkgs.file + cc + pkgs.coreutils + ] ++ lib.optional pkgs.stdenv.isDarwin pkgs.stdenv.cc.bintools; inputsFrom = [ ws.shell ]; shellHook = '' # Set CARGO_HOME to minimize interaction with any environment outside nix diff --git a/nix/sources.json b/nix/sources.json index ef764b5958..79a5d269c6 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -28,7 +28,7 @@ "common": { "ref": "master", "repo": "ssh://git@github.com/dfinity-lab/common", - "rev": "fa5190ac6a299744e1174a576fa540b7fd856bff", + "rev": "027bda4a40176ef3eb676610d8673affe6cde81c", "type": "git" }, "dfinity": {