nixide/rust/nci.nix
Robert Hensing 4dca986fe2 feat: Add nix overrides to make bindgen work
(cherry picked from commit 7caeec86a016fc7427d71ac3713adb2293c2e1ce)
2025-09-30 18:05:54 +02:00

33 lines
993 B
Nix

{
perSystem = { lib, config, pkgs, ... }: {
# https://flake.parts/options/nix-cargo-integration
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";
};
};
};
};
}