treewide: use rustPlatform.bindgenHook (#360427)

This commit is contained in:
Aleksana 2024-11-30 23:16:23 +08:00 committed by GitHub
commit 5a7a68136d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 15 additions and 63 deletions

View File

@ -1,9 +1,6 @@
{ lib
, rustPlatform
, fetchFromGitHub
, llvmPackages
, stdenv
, darwin
}:
rustPlatform.buildRustPackage rec {
@ -19,19 +16,9 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-ma7JVbWSiKfkCXCDwA8DFm2+KPrWR+8nSdgGSqehNg8=";
env = {
LIBCLANG_PATH = "${lib.getLib llvmPackages.libclang}/lib";
};
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks; [
Cocoa
IOKit
Foundation
DiskArbitration
]
);
nativeBuildInputs = [
rustPlatform.bindgenHook
];
RUSTFLAGS = "--cfg tracing_unstable";

View File

@ -1,28 +1,13 @@
{ lib
, buildPackages
, clang
, fetchFromGitHub
, libclang
, libiconv
, llvmPackages_12
, openssl
, pkg-config
, protobuf
, rustPlatform
, stdenv
, Security
, SystemConfiguration
}:
let
# Rust rocksdb bindings have C++ compilation/linking errors on Darwin when using newer clang
# Forcing it to clang 12 fixes the issue.
buildRustPackage =
if stdenv.hostPlatform.isDarwin then
rustPlatform.buildRustPackage.override { stdenv = llvmPackages_12.stdenv; }
else
rustPlatform.buildRustPackage;
in
buildRustPackage rec {
rustPlatform.buildRustPackage rec {
pname = "fedimint";
version = "0.4.4";
@ -38,17 +23,11 @@ buildRustPackage rec {
nativeBuildInputs = [
protobuf
pkg-config
clang
(lib.getLib libclang)
rustPlatform.bindgenHook
];
buildInputs = [
openssl
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
Security
libiconv
Security
SystemConfiguration
];
outputs = [ "out" "fedimintCli" "fedimint" "gateway" "gatewayCli" "devimint" ];
@ -79,7 +58,6 @@ buildRustPackage rec {
PROTOC = "${buildPackages.protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";
OPENSSL_DIR = openssl.dev;
LIBCLANG_PATH = "${lib.getLib libclang}/lib";
FEDIMINT_BUILD_FORCE_GIT_HASH = "0000000000000000000000000000000000000000";

View File

@ -11,7 +11,6 @@
, pipewire
, virglrenderer
, libkrunfw
, llvmPackages
, rustc
, withGpu ? false
, withSound ? false
@ -38,8 +37,8 @@ stdenv.mkDerivation (finalAttrs: {
};
nativeBuildInputs = [
llvmPackages.clang
rustPlatform.cargoSetupHook
rustPlatform.bindgenHook
cargo
rustc
] ++ lib.optional (sevVariant || withGpu) pkg-config;
@ -52,8 +51,6 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional withSound pipewire
++ lib.optional sevVariant openssl;
env.LIBCLANG_PATH = "${lib.getLib llvmPackages.clang-unwrapped}/lib/libclang.so";
makeFlags = [
"PREFIX=${placeholder "out"}"
] ++ lib.optional withGpu "GPU=1"

View File

@ -6,7 +6,6 @@
, alsa-lib
, wayland
, makeWrapper
, llvmPackages
, libxkbcommon
, vulkan-loader
, xorg
@ -33,8 +32,8 @@ rustPlatform.buildRustPackage {
nativeBuildInputs = [
pkg-config
llvmPackages.clang
makeWrapper
rustPlatform.bindgenHook
];
cargoLock = {
@ -54,10 +53,6 @@ rustPlatform.buildRustPackage {
install -Dm 644 flatpak/com.github.polymeilex.neothesia.png $out/share/icons/hicolor/256x256/apps/com.github.polymeilex.neothesia.png
'';
env = {
LIBCLANG_PATH = "${lib.getLib llvmPackages.libclang}/lib";
};
meta = {
description = "Flashy Synthesia Like Software For Linux, Windows and macOS";
homepage = "https://github.com/PolyMeilex/Neothesia";

View File

@ -4,10 +4,9 @@
fetchFromGitHub,
rustPlatform,
apple-sdk_11,
llvmPackages,
nix-update-script,
...
}:
rustPlatform.buildRustPackage {
pname = "nufmt";
version = "0-unstable-2024-11-21";
@ -19,12 +18,14 @@ rustPlatform.buildRustPackage {
hash = "sha256-ideILLOawU6BNawmr4lqt2LGkf29wvlwQe9gqgdYRiI=";
};
nativeBuildInputs = [
rustPlatform.bindgenHook
];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
apple-sdk_11
];
env.LIBCLANG_PATH = lib.optionalString stdenv.cc.isClang "${lib.getLib llvmPackages.libclang}/lib";
cargoHash = "sha256-MHZlXmHAYIiaB6Isutqjrh45jppRzTZRSE3VqzpFBBA=";
passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };

View File

@ -110,6 +110,7 @@ rustPlatform.buildRustPackage {
perl
pkg-config
python3
rustPlatform.bindgenHook
taplo
which
yasm
@ -142,8 +143,6 @@ rustPlatform.buildRustPackage {
--prefix LD_LIBRARY_PATH : ${runtimePaths}
'';
LIBCLANG_PATH = "${lib.getLib llvmPackages.libclang}/lib";
meta = {
description = "The embeddable, independent, memory-safe, modular, parallel web rendering engine";
homepage = "https://servo.org";

View File

@ -24,7 +24,7 @@ rustPlatform.buildRustPackage {
nativeBuildInputs = [
pkg-config
llvmPackages.clang
rustPlatform.bindgenHook
];
buildInputs = [
elfutils
@ -33,7 +33,6 @@ rustPlatform.buildRustPackage {
];
env = {
LIBCLANG_PATH = "${lib.getLib llvmPackages.libclang}/lib";
BPF_CLANG = lib.getExe llvmPackages.clang;
BPF_EXTRA_CFLAGS_PRE_INCL = lib.concatStringsSep " " [
"-I${scx.cscheds.dev}/libbpf/src/usr/include"

View File

@ -2345,10 +2345,6 @@ with pkgs;
fdroidcl = pkgs.callPackage ../development/mobile/fdroidcl { };
fedimint = callPackage ../by-name/fe/fedimint/package.nix {
inherit (darwin.apple_sdk.frameworks) Security SystemConfiguration;
};
flowgger = callPackage ../tools/misc/flowgger {
inherit (darwin.apple_sdk.frameworks) CoreServices;
};