From cf3f598590f8d800963e1b3cba672770aff63884 Mon Sep 17 00:00:00 2001 From: James Kay Date: Fri, 4 Oct 2024 14:58:33 +0100 Subject: [PATCH] Fix Nix flake build (#2570) --- default.nix | 6 +++++- flake.nix | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/default.nix b/default.nix index a344d795507..e8fcde1118c 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,4 @@ -{ crane, pkgs, rust-toolchain }: +{ crane, pkgs, rust-toolchain, libclang, rocksdb, git }: ((crane.mkLib pkgs).overrideToolchain rust-toolchain).buildPackage { pname = "linera"; src = ./.; @@ -15,6 +15,7 @@ nodejs openssl protobuf + git ]; checkInputs = with pkgs; [ # for native testing @@ -29,4 +30,7 @@ wasm-pack ]; passthru = { inherit rust-toolchain; }; + RUST_SRC_PATH = rust-toolchain.availableComponents.rust-src; + LIBCLANG_PATH = "${libclang.lib}/lib"; + ROCKSDB_LIB_DIR = "${rocksdb}/lib"; } diff --git a/flake.nix b/flake.nix index 7922765b2f6..03394833908 100644 --- a/flake.nix +++ b/flake.nix @@ -27,17 +27,17 @@ ./toolchains/stable/rust-toolchain.toml); rust-nightly = (pkgs.rust-bin.fromRustupToolchainFile ./toolchains/nightly/rust-toolchain.toml); - devShell = rust-toolchain: pkgs.mkShell { + devShell = rust-toolchain: let linera' = linera rust-toolchain; in pkgs.mkShell { inputsFrom = [ config.treefmt.build.devShell - (linera rust-toolchain) + linera' ]; shellHook = '' # For rust-analyzer 'hover' tooltips to work. - export RUST_SRC_PATH=${rust-toolchain.availableComponents.rust-src} - export LIBCLANG_PATH=${pkgs.libclang.lib}/lib export PATH=$PWD/target/debug:~/.cargo/bin:$PATH - export ROCKSDB_LIB_DIR=${pkgs.rocksdb}/lib + export RUST_SRC_PATH="${linera'.RUST_SRC_PATH}" + export LIBCLANG_PATH="${linera'.LIBCLANG_PATH}" + export ROCKSDB_LIB_DIR="${linera'.ROCKSDB_LIB_DIR}"; ''; nativeBuildInputs = with pkgs; [ rust-analyzer @@ -49,7 +49,7 @@ overlays = [ (import inputs.rust-overlay) ]; }; - packages.default = linera; + packages.default = linera rust-stable; # Rust dev environment devShells.default = devShell rust-stable;