mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-16 18:28:22 -07:00
2b63e46fc5
This mostly just improves build times.
85 lines
2.1 KiB
Nix
85 lines
2.1 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
fenix = {
|
|
url = "github:nix-community/fenix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
naersk = {
|
|
url = "github:nix-community/naersk";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{ self
|
|
, nixpkgs
|
|
, flake-utils
|
|
|
|
, fenix
|
|
, naersk
|
|
}: flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
# Nix-accessible `Cargo.toml`
|
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
|
|
|
# The Rust toolchain to use
|
|
toolchain = fenix.packages.${system}.toolchainOf {
|
|
# Use the Rust version defined in `Cargo.toml`
|
|
channel = cargoToml.package.rust-version;
|
|
|
|
# THE rust-version HASH
|
|
sha256 = "sha256-8len3i8oTwJSOJZMosGGXHBL5BVuGQnWOT2St5YAUFU=";
|
|
};
|
|
|
|
# Point to system RocksDB
|
|
ROCKSDB_INCLUDE_DIR = "${pkgs.rocksdb_6_23}/include";
|
|
ROCKSDB_LIB_DIR = "${pkgs.rocksdb_6_23}/lib";
|
|
|
|
builder = (pkgs.callPackage naersk {
|
|
inherit (toolchain) rustc cargo;
|
|
}).buildPackage;
|
|
in
|
|
{
|
|
packages.default = builder {
|
|
src = ./.;
|
|
|
|
# Use system RocksDB
|
|
inherit ROCKSDB_INCLUDE_DIR ROCKSDB_LIB_DIR;
|
|
|
|
nativeBuildInputs = (with pkgs.rustPlatform; [
|
|
bindgenHook
|
|
]);
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
# 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";
|
|
|
|
# Use system RocksDB
|
|
inherit ROCKSDB_INCLUDE_DIR ROCKSDB_LIB_DIR;
|
|
|
|
# Development tools
|
|
nativeBuildInputs = (with pkgs.rustPlatform; [
|
|
bindgenHook
|
|
]) ++ (with toolchain; [
|
|
cargo
|
|
clippy
|
|
rust-src
|
|
rustc
|
|
rustfmt
|
|
]);
|
|
};
|
|
|
|
checks = {
|
|
packagesDefault = self.packages.${system}.default;
|
|
devShellsDefault = self.devShells.${system}.default;
|
|
};
|
|
});
|
|
}
|