ebpf-sandbox/packages.nix

25 lines
578 B
Nix
Raw Normal View History

2024-12-25 11:02:54 +00:00
{
flake-utils,
nixpkgs,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
mkEbpfProg = name: src: pkgs.clangStdenv.mkDerivation {
name = "ebpf-${name}";
inherit src;
hardeningDisable = [ "stackprotector" "zerocallusedregs" ];
dontFixup = true;
buildInputs = with pkgs; [ libbpf ];
buildPhase = ''
clang -O2 -target bpf -g -c ${src}/main.c -o $out
'';
};
in {
packages = {
dropworld = mkEbpfProg "dropworld" ./dropworld;
tcpfilter = mkEbpfProg "tcpfilter" ./tcpfilter;
};
})