1
0
Fork 0
mirror of https://github.com/zhaofengli/attic.git synced 2025-03-15 13:07:49 +00:00

Temporary workaround to fix bindgen on Darwin

https://github.com/NixOS/nixpkgs/pull/207352#issuecomment-1418363441
This commit is contained in:
Zhaofeng Li 2023-02-06 13:54:21 -07:00
parent 1ffa429a9b
commit 9869ab4a85
2 changed files with 14 additions and 2 deletions

View file

@ -8,6 +8,7 @@
{ stdenv { stdenv
, lib , lib
, craneLib , craneLib
, llvmPackages
, rustPlatform , rustPlatform
, runCommand , runCommand
, writeReferencesToFile , writeReferencesToFile
@ -32,7 +33,6 @@ let
}; };
nativeBuildInputs = [ nativeBuildInputs = [
rustPlatform.bindgenHook
pkg-config pkg-config
installShellFiles installShellFiles
]; ];
@ -68,6 +68,12 @@ let
cargoExtraArgs = "-p attic-client -p attic-server"; 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) '' postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
if [[ -f $out/bin/attic ]]; then if [[ -f $out/bin/attic ]]; then
installShellCompletion --cmd attic \ installShellCompletion --cmd attic \

View file

@ -7,6 +7,7 @@
{ lib, stdenv, rustPlatform { lib, stdenv, rustPlatform
, pkg-config , pkg-config
, installShellFiles , installShellFiles
, llvmPackages
, nix , nix
, boost , boost
, darwin , darwin
@ -31,7 +32,6 @@ in rustPlatform.buildRustPackage rec {
}; };
nativeBuildInputs = [ nativeBuildInputs = [
rustPlatform.bindgenHook
pkg-config pkg-config
installShellFiles installShellFiles
]; ];
@ -50,6 +50,12 @@ in rustPlatform.buildRustPackage rec {
ATTIC_DISTRIBUTOR = "attic"; 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 # Recursive Nix is not stable yet
doCheck = false; doCheck = false;