about summary refs log tree commit diff
path: root/pkgs/development/tools/bpf-linker
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2022-07-24 13:35:45 +0800
committerNick Cao <nickcao@nichi.co>2022-07-24 13:36:10 +0800
commita67bbc746517d6d7028f6f1ba5de33b5406320a9 (patch)
tree562c570c961dcf9fb5b7e48117d7eee865c4f5f0 /pkgs/development/tools/bpf-linker
parentbafd04616fa36ad8d2640da87cb225b8df487582 (diff)
bpf-linker: init at 0.9.4
Diffstat (limited to 'pkgs/development/tools/bpf-linker')
-rw-r--r--pkgs/development/tools/bpf-linker/default.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/development/tools/bpf-linker/default.nix b/pkgs/development/tools/bpf-linker/default.nix
new file mode 100644
index 0000000000000..d1839eb86fabb
--- /dev/null
+++ b/pkgs/development/tools/bpf-linker/default.nix
@@ -0,0 +1,43 @@
+{ lib
+, stdenv
+, rustPlatform
+, fetchFromGitHub
+, llvmPackages_14
+, zlib
+, ncurses
+, libxml2
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "bpf-linker";
+  version = "0.9.4";
+
+  src = fetchFromGitHub {
+    owner = "aya-rs";
+    repo = pname;
+    rev = "v${version}";
+    hash = "sha256-jYuBk78aGQLUeNF6d6kjGPuMxEF22XJquHcs23WVGm0=";
+  };
+
+  cargoHash = "sha256-X8EVpOxDHwE/wj/gly/wdZ6tsrMrz3kkDe9gEPbk6iw=";
+
+  buildNoDefaultFeatures = true;
+  buildFeatures = [ "system-llvm" ];
+
+  nativeBuildInputs = [ llvmPackages_14.llvm ];
+  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;
+
+  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;
+  };
+}