diff --git a/crane.nix b/crane.nix index 7fd888a..e53363b 100644 --- a/crane.nix +++ b/crane.nix @@ -8,6 +8,7 @@ { stdenv , lib , craneLib +, llvmPackages , rustPlatform , runCommand , writeReferencesToFile @@ -32,7 +33,6 @@ let }; nativeBuildInputs = [ - rustPlatform.bindgenHook pkg-config installShellFiles ]; @@ -68,6 +68,12 @@ let cargoExtraArgs = "-p attic-client -p attic-server"; + # Temporary workaround for https://github.com/NixOS/nixpkgs/pull/207352#issuecomment-1418363441 + preBuild = '' + export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib" + export BINDGEN_EXTRA_CLANG_ARGS="$(< ${llvmPackages.clang}/nix-support/cc-cflags) $(< ${llvmPackages.clang}/nix-support/libc-cflags) $(< ${llvmPackages.clang}/nix-support/libcxx-cxxflags) $NIX_CFLAGS_COMPILE" + ''; + postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' if [[ -f $out/bin/attic ]]; then installShellCompletion --cmd attic \ diff --git a/package.nix b/package.nix index bc3c53f..2303449 100644 --- a/package.nix +++ b/package.nix @@ -7,6 +7,7 @@ { lib, stdenv, rustPlatform , pkg-config , installShellFiles +, llvmPackages , nix , boost , darwin @@ -31,7 +32,6 @@ in rustPlatform.buildRustPackage rec { }; nativeBuildInputs = [ - rustPlatform.bindgenHook pkg-config installShellFiles ]; @@ -50,6 +50,12 @@ in rustPlatform.buildRustPackage rec { ATTIC_DISTRIBUTOR = "attic"; + # Temporary workaround for https://github.com/NixOS/nixpkgs/pull/207352#issuecomment-1418363441 + preBuild = '' + export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib" + export BINDGEN_EXTRA_CLANG_ARGS="$(< ${llvmPackages.clang}/nix-support/cc-cflags) $(< ${llvmPackages.clang}/nix-support/libc-cflags) $(< ${llvmPackages.clang}/nix-support/libcxx-cxxflags) $NIX_CFLAGS_COMPILE" + ''; + # Recursive Nix is not stable yet doCheck = false;