nixpkgs/pkgs/development/tools/bpf-linker/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.3 KiB
Nix
Raw Normal View History

2022-07-24 05:35:45 +00:00
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
2023-02-12 18:01:15 +00:00
, llvmPackages_15
2022-07-24 05:35:45 +00:00
, zlib
, ncurses
, libxml2
}:
rustPlatform.buildRustPackage rec {
pname = "bpf-linker";
2023-02-12 18:01:15 +00:00
version = "0.9.5";
2022-07-24 05:35:45 +00:00
src = fetchFromGitHub {
owner = "aya-rs";
repo = pname;
rev = "v${version}";
2023-02-12 18:01:15 +00:00
hash = "sha256-LEZ2to1bzJ/H/XYytuh/7NT7+04aI8chpKIFxxVzM+4=";
2022-07-24 05:35:45 +00:00
};
2023-02-12 18:01:15 +00:00
cargoHash = "sha256-s8cW7lXtvgemuQueTtAywewnDVJ/WDcz8SBqsC/tO80=";
2022-07-24 05:35:45 +00:00
buildNoDefaultFeatures = true;
buildFeatures = [ "system-llvm" ];
2023-02-12 18:01:15 +00:00
nativeBuildInputs = [ llvmPackages_15.llvm ];
2022-07-24 05:35:45 +00:00
buildInputs = [ zlib ncurses libxml2 ];
# fails with: couldn't find crate `core` with expected target triple bpfel-unknown-none
# rust-src and `-Z build-std=core` are required to properly run the tests
doCheck = false;
2023-11-22 14:51:31 +00:00
# Work around https://github.com/NixOS/nixpkgs/issues/166205.
env = lib.optionalAttrs stdenv.cc.isClang {
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
};
2022-07-24 05:35:45 +00:00
meta = with lib; {
description = "Simple BPF static linker";
homepage = "https://github.com/aya-rs/bpf-linker";
license = with licenses; [ asl20 mit ];
maintainers = with maintainers; [ nickcao ];
# llvm-sys crate locates llvm by calling llvm-config
# which is not available when cross compiling
broken = stdenv.buildPlatform != stdenv.hostPlatform;
};
}