46 lines
1.3 KiB
Nix
46 lines
1.3 KiB
Nix
{
|
|
description = "fancy_mdbx";
|
|
|
|
inputs = {
|
|
utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, utils }:
|
|
utils.lib.eachDefaultSystem (system: let
|
|
pkgs = nixpkgs.legacyPackages."${system}";
|
|
in rec {
|
|
# `nix develop`
|
|
devShell = pkgs.mkShell {
|
|
nativeBuildInputs =
|
|
let
|
|
rust-toolchain = pkgs.symlinkJoin {
|
|
name = "rust-toolchain";
|
|
paths = with pkgs; [rustc cargo rustfmt rustPlatform.rustcSrc];
|
|
};
|
|
in
|
|
[
|
|
rust-toolchain
|
|
];
|
|
|
|
# Needed for bindgen when binding to mdbx
|
|
LIBCLANG_PATH="${pkgs.llvmPackages_latest.libclang.lib}/lib";
|
|
|
|
# Cargo culted:
|
|
# Add to rustc search path
|
|
RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [
|
|
]);
|
|
# Add to bindgen search path
|
|
BINDGEN_EXTRA_CLANG_ARGS =
|
|
# Includes with normal include path
|
|
(builtins.map (a: ''-I"${a}/include"'') [
|
|
# C standard library
|
|
pkgs.glibc.dev
|
|
])
|
|
# Includes with special directory paths
|
|
++ [
|
|
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
|
|
];
|
|
};
|
|
});
|
|
}
|