From a30de301fc1bafbd5abc414df0bd197ecfc0689e Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sat, 28 Dec 2024 13:25:16 +0100 Subject: [PATCH] bpfman: init at 0.5.4 --- pkgs/by-name/bp/bpfman/package.nix | 72 ++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 pkgs/by-name/bp/bpfman/package.nix diff --git a/pkgs/by-name/bp/bpfman/package.nix b/pkgs/by-name/bp/bpfman/package.nix new file mode 100644 index 00000000000000..5b4d24ad3baac1 --- /dev/null +++ b/pkgs/by-name/bp/bpfman/package.nix @@ -0,0 +1,72 @@ +{ + lib, + rustPlatform, + fetchFromGitHub, + llvmPackages_12, + pkg-config, + openssl, + enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, + installShellFiles, + stdenv, + systemd, + ... +}: +rustPlatform.buildRustPackage rec { + pname = "bpfman"; + version = "0.5.4"; + + src = fetchFromGitHub { + owner = "bpfman"; + repo = "bpfman"; + rev = "v${version}"; + hash = "sha256-HD8Qdy7wvV2zGoPRLYZu+NpG28T5Q4WfLr5UnZB+bkg="; + }; + + useFetchCargoVendor = true; + cargoHash = "sha256-X9qSGSXRX8WEGKD4Wc2iRhmky1uGCspG8muyCsyeIiQ="; + + nativeBuildInputs = [ + llvmPackages_12.llvm + pkg-config + installShellFiles + ]; + buildInputs = [ openssl ]; + + postInstall = + '' + compdir=./.output/completions + cargo xtask build-completion + installShellCompletion --cmd bpfman \ + --bash $compdir/bpfman.bash \ + --fish $compdir/bpfman.fish \ + --fish $compdir/bpfman.elv + '' + + lib.optionalString enableSystemd '' + mkdir -p $out/lib/systemd/system + cp scripts/bpfman.socket $out/lib/systemd/system + substitute scripts/bpfman.service \ + $out/lib/systemd/system/bpfman.service \ + --replace /usr/sbin/bpfman-rpc $out/bin/bpfman-rpc + ''; + + checkFlags = [ + # Tests needing network connectivity + "--skip=oci_utils::image_manager::tests::image_pull_and_bytecode_verify" + "--skip=oci_utils::image_manager::tests::image_pull_and_bytecode_verify_legacy" + "--skip=oci_utils::image_manager::tests::image_pull_failure" + "--skip=oci_utils::image_manager::tests::image_pull_policy_never_failure" + "--skip=oci_utils::image_manager::tests::private_image_pull_and_bytecode_verify" + ]; + + meta = with lib; { + description = "An eBPF Manager for Linux and Kubernetes"; + mainProgram = "bpfman"; + homepage = "https://bpfman.io"; + license = with licenses; [ + asl20 + bsd2 + gpl2Only + ]; + maintainers = with maintainers; [ pizzapim ]; + }; +}