|
|
|
|
@ -43,53 +43,64 @@
|
|
|
|
|
sha256 = "sha256-gdYqng0y9iHYzYPAdkC/ka3DRny3La/S5G8ASj0Ayyc="; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
# The system's RocksDB |
|
|
|
|
ROCKSDB_INCLUDE_DIR = "${pkgs.rocksdb}/include"; |
|
|
|
|
ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib"; |
|
|
|
|
mkToolchain = fenix.packages.${system}.combine; |
|
|
|
|
|
|
|
|
|
buildToolchain = mkToolchain (with toolchain; [ |
|
|
|
|
cargo |
|
|
|
|
rustc |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
devToolchain = mkToolchain (with toolchain; [ |
|
|
|
|
cargo |
|
|
|
|
clippy |
|
|
|
|
rust-src |
|
|
|
|
rustc |
|
|
|
|
|
|
|
|
|
# Always use nightly rustfmt because most of its options are unstable |
|
|
|
|
fenix.packages.${system}.latest.rustfmt |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
builder = |
|
|
|
|
((crane.mkLib pkgs).overrideToolchain buildToolchain).buildPackage; |
|
|
|
|
|
|
|
|
|
# Shared between the package and the devShell |
|
|
|
|
nativeBuildInputs = (with pkgs.rustPlatform; [ |
|
|
|
|
bindgenHook |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
builder = |
|
|
|
|
((crane.mkLib pkgs).overrideToolchain toolchain.toolchain).buildPackage; |
|
|
|
|
env = { |
|
|
|
|
ROCKSDB_INCLUDE_DIR = "${pkgs.rocksdb}/include"; |
|
|
|
|
ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib"; |
|
|
|
|
}; |
|
|
|
|
in |
|
|
|
|
{ |
|
|
|
|
packages.default = builder { |
|
|
|
|
src = ./.; |
|
|
|
|
|
|
|
|
|
# This is redundant with CI |
|
|
|
|
doCheck = false; |
|
|
|
|
|
|
|
|
|
inherit |
|
|
|
|
stdenv |
|
|
|
|
env |
|
|
|
|
nativeBuildInputs |
|
|
|
|
ROCKSDB_INCLUDE_DIR |
|
|
|
|
ROCKSDB_LIB_DIR; |
|
|
|
|
stdenv; |
|
|
|
|
|
|
|
|
|
meta.mainProgram = cargoToml.package.name; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
devShells.default = (pkgs.mkShell.override { inherit stdenv; }) { |
|
|
|
|
# Rust Analyzer needs to be able to find the path to default crate |
|
|
|
|
# sources, and it can read this environment variable to do so |
|
|
|
|
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library"; |
|
|
|
|
|
|
|
|
|
inherit |
|
|
|
|
ROCKSDB_INCLUDE_DIR |
|
|
|
|
ROCKSDB_LIB_DIR; |
|
|
|
|
env = env // { |
|
|
|
|
# Rust Analyzer needs to be able to find the path to default crate |
|
|
|
|
# sources, and it can read this environment variable to do so. The |
|
|
|
|
# `rust-src` component is required in order for this to work. |
|
|
|
|
RUST_SRC_PATH = "${devToolchain}/lib/rustlib/src/rust/library"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
# Development tools |
|
|
|
|
nativeBuildInputs = nativeBuildInputs ++ (with toolchain; [ |
|
|
|
|
cargo |
|
|
|
|
clippy |
|
|
|
|
rust-src |
|
|
|
|
rustc |
|
|
|
|
rustfmt |
|
|
|
|
]) ++ (with pkgs; [ |
|
|
|
|
nativeBuildInputs = nativeBuildInputs ++ [ |
|
|
|
|
devToolchain |
|
|
|
|
] ++ (with pkgs; [ |
|
|
|
|
engage |
|
|
|
|
]); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
checks = { |
|
|
|
|
packagesDefault = self.packages.${system}.default; |
|
|
|
|
devShellsDefault = self.devShells.${system}.default; |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|