feat: Add nix overrides to make bindgen work
(cherry picked from commit 7caeec86a016fc7427d71ac3713adb2293c2e1ce)
This commit is contained in:
parent
a4bdbe5618
commit
4dca986fe2
3 changed files with 125 additions and 3 deletions
31
rust/nci.nix
31
rust/nci.nix
|
|
@ -1,6 +1,33 @@
|
|||
{
|
||||
perSystem = { pkgs, config, ... }: {
|
||||
perSystem = { lib, config, pkgs, ... }: {
|
||||
# https://flake.parts/options/nix-cargo-integration
|
||||
nci.projects.nix-bindings.path = ./.;
|
||||
nci.projects.nix-bindings = {
|
||||
path = ./.;
|
||||
drvConfig = {
|
||||
mkDerivation = {
|
||||
buildInputs = [
|
||||
config.packages.nix
|
||||
# stdbool.h
|
||||
pkgs.stdenv.cc
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
pkgs.pkg-config
|
||||
];
|
||||
};
|
||||
# NOTE: duplicated in flake.nix devShell
|
||||
env = {
|
||||
LIBCLANG_PATH =
|
||||
if pkgs.stdenv.cc.isClang then
|
||||
null # don't set the variable
|
||||
else
|
||||
lib.makeLibraryPath [ pkgs.buildPackages.llvmPackages.clang-unwrapped ];
|
||||
BINDGEN_EXTRA_CLANG_ARGS =
|
||||
if pkgs.stdenv.cc.isClang then
|
||||
null # don't set the variable
|
||||
else
|
||||
"-I${lib.getDev pkgs.stdenv.cc.cc}/lib/gcc/${pkgs.stdenv.hostPlatform.config}/${pkgs.stdenv.cc.cc.version}/include";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue