feat: nix-c-raw: Generate value api bindings

(cherry picked from commit 3c75dea63233670863f30547f90dd71498d547b0)
This commit is contained in:
Robert Hensing 2024-03-07 10:56:24 +01:00
parent 270ccaaa57
commit 0d7146cb39
3 changed files with 10 additions and 0 deletions

View file

@ -49,6 +49,8 @@
buildInputs = [
config.packages.nix
];
# Workaround: the gcc in the devshell doesn't find libc headers
RUST_NIX_C_RAW_EXTRA_CFLAGS = "-I${pkgs.stdenv.cc.libc.dev}/include";
nativeBuildInputs = [
pkgs.rust-analyzer
pkgs.nixpkgs-fmt

View file

@ -36,6 +36,13 @@ fn c_headers() -> Vec<String> {
{
args.push(format!("-I{}", path.to_str().unwrap()));
}
if let Ok(cflags) = std::env::var("RUST_NIX_C_RAW_EXTRA_CFLAGS") {
for flag in cflags.split_whitespace() {
args.push(flag.to_string());
}
}
// write to stderr for debugging
eprintln!("c_headers: {:?}", args);
args

View file

@ -1,3 +1,4 @@
#include <nix_api_util.h>
#include <nix_api_store.h>
#include <nix_api_expr.h>
#include <nix_api_value.h>