From df6a7e941ab26bb30688643694f469e5450c5835 Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Tue, 29 Nov 2022 12:00:00 +0000 Subject: treewide: use bindgenhook where possible --- pkgs/applications/blockchains/electrs/default.nix | 3 +-- pkgs/applications/blockchains/lighthouse/default.nix | 4 +--- pkgs/applications/blockchains/nearcore/default.nix | 4 +--- pkgs/applications/blockchains/polkadot/default.nix | 3 +-- pkgs/applications/blockchains/snarkos/default.nix | 4 +--- pkgs/applications/blockchains/solana-validator/default.nix | 7 ++----- pkgs/applications/blockchains/teos/default.nix | 9 +++------ .../editors/emacs/elisp-packages/manual-packages/tsc/default.nix | 6 +----- pkgs/applications/misc/authenticator/default.nix | 4 +--- pkgs/applications/misc/clipcat/default.nix | 5 +---- pkgs/applications/misc/imag/default.nix | 4 +--- 11 files changed, 14 insertions(+), 39 deletions(-) diff --git a/pkgs/applications/blockchains/electrs/default.nix b/pkgs/applications/blockchains/electrs/default.nix index 35470a7b8542c..0bc5c7baa4161 100644 --- a/pkgs/applications/blockchains/electrs/default.nix +++ b/pkgs/applications/blockchains/electrs/default.nix @@ -24,8 +24,7 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-p4t+G13XaCl7+IbX5YyBFF0PmARbw4XlRvnA0PRcjvQ="; # needed for librocksdb-sys - nativeBuildInputs = [ llvmPackages.clang ]; - LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; + nativeBuildInputs = [ rustPlatform.bindgenHook ]; # link rocksdb dynamically ROCKSDB_INCLUDE_DIR = "${rocksdb}/include"; diff --git a/pkgs/applications/blockchains/lighthouse/default.nix b/pkgs/applications/blockchains/lighthouse/default.nix index c778ce3f75755..3eebd80cb5934 100644 --- a/pkgs/applications/blockchains/lighthouse/default.nix +++ b/pkgs/applications/blockchains/lighthouse/default.nix @@ -34,14 +34,12 @@ rustPlatform.buildRustPackage rec { buildFeatures = [ "modern" "gnosis" ]; - nativeBuildInputs = [ clang cmake perl protobuf ]; + nativeBuildInputs = [ rustPlatform.bindgenHook cmake perl protobuf ]; buildInputs = lib.optionals stdenv.isDarwin [ Security ]; - LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; - depositContractSpec = fetchurl { url = "https://raw.githubusercontent.com/ethereum/eth2.0-specs/v${depositContractSpecVersion}/deposit_contract/contracts/validator_registration.json"; hash = "sha256-ZslAe1wkmkg8Tua/AmmEfBmjqMVcGIiYHwi+WssEwa8="; diff --git a/pkgs/applications/blockchains/nearcore/default.nix b/pkgs/applications/blockchains/nearcore/default.nix index 44bfcc3a6e00f..a929406cee929 100644 --- a/pkgs/applications/blockchains/nearcore/default.nix +++ b/pkgs/applications/blockchains/nearcore/default.nix @@ -42,14 +42,12 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ pkg-config protobuf + rustPlatform.bindgenHook ]; # fat LTO requires ~3.4GB RAM requiredSystemFeatures = [ "big-parallel" ]; - LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; - BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${llvmPackages.libclang.lib}/lib/clang/${lib.getVersion llvmPackages.clang}/include"; - meta = with lib; { description = "Reference client for NEAR Protocol"; homepage = "https://github.com/near/nearcore"; diff --git a/pkgs/applications/blockchains/polkadot/default.nix b/pkgs/applications/blockchains/polkadot/default.nix index 443fe36143c50..596130337c7ad 100644 --- a/pkgs/applications/blockchains/polkadot/default.nix +++ b/pkgs/applications/blockchains/polkadot/default.nix @@ -36,14 +36,13 @@ rustPlatform.buildRustPackage rec { buildInputs = lib.optionals stdenv.isDarwin [ Security ]; - nativeBuildInputs = [ clang ]; + nativeBuildInputs = [ rustPlatform.bindgenHook ]; preBuild = '' export SUBSTRATE_CLI_GIT_COMMIT_HASH=$(cat .git_commit) rm .git_commit ''; - LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; PROTOC = "${protobuf}/bin/protoc"; # NOTE: We don't build the WASM runtimes since this would require a more diff --git a/pkgs/applications/blockchains/snarkos/default.nix b/pkgs/applications/blockchains/snarkos/default.nix index 82c3555f64d6a..fe8b24b6ca227 100644 --- a/pkgs/applications/blockchains/snarkos/default.nix +++ b/pkgs/applications/blockchains/snarkos/default.nix @@ -23,15 +23,13 @@ rustPlatform.buildRustPackage rec { # buildAndTestSubdir = "cli"; - nativeBuildInputs = lib.optionals stdenv.isLinux [ pkg-config llvmPackages.clang ]; + nativeBuildInputs = lib.optionals stdenv.isLinux [ pkg-config rustPlatform.bindgenHook ]; # Needed to get openssl-sys to use pkg-config. OPENSSL_NO_VENDOR = 1; OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib"; OPENSSL_DIR="${lib.getDev openssl}"; - LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib"; - # TODO check why rust compilation fails by including the rocksdb from nixpkgs # Used by build.rs in the rocksdb-sys crate. If we don't set these, it would # try to build RocksDB from source. diff --git a/pkgs/applications/blockchains/solana-validator/default.nix b/pkgs/applications/blockchains/solana-validator/default.nix index 503d4b404e728..bb35f7be38892 100644 --- a/pkgs/applications/blockchains/solana-validator/default.nix +++ b/pkgs/applications/blockchains/solana-validator/default.nix @@ -68,12 +68,9 @@ rustPlatform.buildRustPackage rec { cargoBuildFlags = builtins.map (n: "--bin=${n}") solanaPkgs; # weird errors. see https://github.com/NixOS/nixpkgs/issues/52447#issuecomment-852079285 - LIBCLANG_PATH = "${libclang.lib}/lib"; - BINDGEN_EXTRA_CLANG_ARGS = - "-isystem ${libclang.lib}/lib/clang/${lib.getVersion clang}/include"; - LLVM_CONFIG_PATH = "${llvm}/bin/llvm-config"; + # LLVM_CONFIG_PATH = "${llvm}/bin/llvm-config"; - nativeBuildInputs = [ clang llvm pkg-config protobuf rustfmt perl ]; + nativeBuildInputs = [ pkg-config protobuf rustfmt perl rustPlatform.bindgenHook ]; buildInputs = [ openssl zlib libclang hidapi ] ++ (lib.optionals stdenv.isLinux [ udev ]); strictDeps = true; diff --git a/pkgs/applications/blockchains/teos/default.nix b/pkgs/applications/blockchains/teos/default.nix index 197246770d0dc..b1fb1a77c1d48 100644 --- a/pkgs/applications/blockchains/teos/default.nix +++ b/pkgs/applications/blockchains/teos/default.nix @@ -38,11 +38,8 @@ let perl # used by openssl-sys to configure protobuf rustfmt - llvmPackages.clang + rustPlatform.bindgenHook ]; - - - LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; in { teos = rustPlatform.buildRustPackage { @@ -50,7 +47,7 @@ in cargoSha256 = "sha256-7VYYYSMJ2JP1KuA8sD0X3wInubH/jbA/sgzsTsomyEc="; buildAndTestSubdir = "teos"; - inherit version src cargoPatches buildInputs nativeBuildInputs LIBCLANG_PATH; + inherit version src cargoPatches buildInputs nativeBuildInputs; meta = common.meta // { description = "A Lightning watchtower compliant with BOLT13, written in Rust"; @@ -66,7 +63,7 @@ in cargoSha256 = "sha256-xL+DiEfgBYJQ1UJm7LAr1/f34pkU8FRl4Seic8MFAlM="; buildAndTestSubdir = "watchtower-plugin"; - inherit version src cargoPatches buildInputs nativeBuildInputs LIBCLANG_PATH; + inherit version src cargoPatches buildInputs nativeBuildInputs; meta = common.meta // { description = "A Lightning watchtower plugin for clightning"; diff --git a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/tsc/default.nix b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/tsc/default.nix index a9462298979d0..9825ed0834a2e 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/manual-packages/tsc/default.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/manual-packages/tsc/default.nix @@ -43,13 +43,9 @@ let pname = "tsc-dyn"; - nativeBuildInputs = [ clang ]; + nativeBuildInputs = [ rustPlatform.bindgenHook ]; sourceRoot = "source/core"; - configurePhase = '' - export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib" - ''; - postInstall = '' LIB=($out/lib/libtsc_dyn.*) TSC_PATH=$out/share/emacs/site-lisp/elpa/tsc-${version} diff --git a/pkgs/applications/misc/authenticator/default.nix b/pkgs/applications/misc/authenticator/default.nix index cdf6ca3e6f803..735355107ef26 100644 --- a/pkgs/applications/misc/authenticator/default.nix +++ b/pkgs/applications/misc/authenticator/default.nix @@ -42,7 +42,6 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ appstream-glib - clang desktop-file-utils meson ninja @@ -52,6 +51,7 @@ stdenv.mkDerivation rec { cargoSetupHook rust.cargo rust.rustc + bindgenHook ]); buildInputs = [ @@ -69,8 +69,6 @@ stdenv.mkDerivation rec { zbar ]; - LIBCLANG_PATH = "${lib.getLib libclang}/lib"; - meta = { description = "Two-factor authentication code generator for GNOME"; homepage = "https://gitlab.gnome.org/World/Authenticator"; diff --git a/pkgs/applications/misc/clipcat/default.nix b/pkgs/applications/misc/clipcat/default.nix index 38c0c103943a9..be197e819371c 100644 --- a/pkgs/applications/misc/clipcat/default.nix +++ b/pkgs/applications/misc/clipcat/default.nix @@ -14,8 +14,6 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "1n4il3l59m2a6ca54vfaivzg25abf8s4w5kpd5q51p13624iz0kb"; - LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; - # needed for internal protobuf c wrapper library PROTOC = "${protobuf}/bin/protoc"; PROTOC_INCLUDE = "${protobuf}/include"; @@ -23,8 +21,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ pkg-config - clang - llvmPackages.libclang + rustPlatform.bindgenHook rustfmt protobuf diff --git a/pkgs/applications/misc/imag/default.nix b/pkgs/applications/misc/imag/default.nix index b637cd077d761..acc03f59a7018 100644 --- a/pkgs/applications/misc/imag/default.nix +++ b/pkgs/applications/misc/imag/default.nix @@ -21,13 +21,11 @@ rustPlatform.buildRustPackage rec { sha256 = "0f9915f083z5qqcxyavj0w6m973c8m1x7kfb89pah5agryy5mkaq"; }; - nativeBuildInputs = [ installShellFiles pkg-config ]; + nativeBuildInputs = [ installShellFiles pkg-config rustPlatform.bindgenHook ]; buildInputs = [ openssl ] ++ lib.optional stdenv.isDarwin Security; checkInputs = [ gitMinimal util-linuxMinimal ]; - LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; - cargoSha256 = "1vnrc72g2271i2p847z30kplxmdpi60n3dzpw0s7dahg33g14ai6"; checkPhase = '' -- cgit 1.4.1