85 lines
2.4 KiB
Nix
85 lines
2.4 KiB
Nix
{
|
|
description = "Rust wrapper for marisa-trie C++ library";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
overlays = [ (import rust-overlay) ];
|
|
pkgs = import nixpkgs {
|
|
inherit system overlays;
|
|
};
|
|
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
extensions = [ "rust-src" "clippy" "rustfmt" ];
|
|
};
|
|
|
|
# Use nixpkgs marisa-trie package
|
|
marisa-trie = pkgs.marisa;
|
|
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
rustToolchain
|
|
marisa-trie
|
|
|
|
# Build tools
|
|
cmake
|
|
gcc
|
|
pkg-config
|
|
clang
|
|
llvmPackages.libclang.lib
|
|
|
|
# Development tools
|
|
rust-analyzer
|
|
clippy
|
|
rustfmt
|
|
|
|
# C++ development
|
|
gdb
|
|
valgrind
|
|
];
|
|
|
|
shellHook = ''
|
|
echo "Rust marisa-trie development environment"
|
|
echo "Rust version: $(rustc --version)"
|
|
echo "Cargo version: $(cargo --version)"
|
|
echo "marisa-trie library available at: ${marisa-trie}"
|
|
|
|
export PKG_CONFIG_PATH="${marisa-trie}/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
export LD_LIBRARY_PATH="${marisa-trie}/lib:$LD_LIBRARY_PATH"
|
|
export LIBRARY_PATH="${marisa-trie}/lib:$LIBRARY_PATH"
|
|
export CPATH="${marisa-trie}/include:$CPATH"
|
|
export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"
|
|
'';
|
|
|
|
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
|
|
};
|
|
|
|
packages.default = pkgs.rustPlatform.buildRustPackage {
|
|
pname = "marisa-rs";
|
|
version = "0.1.0";
|
|
|
|
src = ./.;
|
|
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
};
|
|
|
|
buildInputs = [ marisa-trie ];
|
|
nativeBuildInputs = with pkgs; [ cmake gcc pkg-config ];
|
|
|
|
meta = with pkgs.lib; {
|
|
description = "Rust wrapper for marisa-trie C++ library";
|
|
license = with licenses; [ mit asl20 ];
|
|
platforms = platforms.unix;
|
|
};
|
|
};
|
|
});
|
|
}
|