forked from foniod/redbpf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
78 lines (70 loc) · 2.04 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
inputs = {
nixpkgs.url = "nixpkgs";
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, utils, naersk, ... }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
naersk-lib = naersk.lib."${system}";
in
rec {
# `nix build`
packages.cargo-bpf = naersk-lib.buildPackage {
meta = with pkgs.lib; {
description = "Rust eBPF tooling";
homepage = "https://foniod.org";
license = licenses.mit;
platforms = [ "x86_64-linux" "aarch64-linux" ];
};
name = "cargo-bpf";
version = "3.0.0";
src = ./.;
root = ./.;
gitSubmodules = true;
LIBCLANG_PATH = "${pkgs.llvmPackages_14.libclang.lib}/lib";
KERNEL_SOURCE = "${pkgs.linuxPackages.kernel.dev}/lib/modules/${pkgs.linuxPackages.kernel.version}";
nativeBuildInputs = with pkgs; [
pkgconfig
llvm_14
clang_14
];
buildInputs = with pkgs; [
openssl
zlib
libxml2
libelf
llvm_13.dev
clang_13
linuxPackages.kernel.dev
linuxHeaders
glibc.dev
];
};
defaultPackage = packages.cargo-bpf;
defaultApp = apps.cargo-bpf;
apps.cargo-bpf = {
type = "app";
program = "${self.defaultPackage."${system}"}/bin/cargo-bpf";
};
# `nix develop`
devShell = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.cargo-bpf ];
nativeBuildInputs = with pkgs; [
cargo
pkg-config
rustc
rust-analyzer
rustfmt
clippy
];
LIBCLANG_PATH = "${pkgs.llvmPackages_14.libclang.lib}/lib";
};
});
}