25 lines
578 B
Nix
25 lines
578 B
Nix
|
{
|
||
|
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;
|
||
|
};
|
||
|
})
|