Skip to content

Commit

Permalink
Fix Nix flake build (linera-io#2570)
Browse files Browse the repository at this point in the history
  • Loading branch information
Twey authored Oct 4, 2024
1 parent 22c9c97 commit cf3f598
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
@@ -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 = ./.;
Expand All @@ -15,6 +15,7 @@
nodejs
openssl
protobuf
git
];
checkInputs = with pkgs; [
# for native testing
Expand All @@ -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";
}
12 changes: 6 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit cf3f598

Please sign in to comment.