lol
1{ lib
2, clang
3, fetchFromGitHub
4, buildGoModule
5}:
6buildGoModule rec {
7 pname = "dae";
8 version = "0.3.0";
9
10 src = fetchFromGitHub {
11 owner = "daeuniverse";
12 repo = "dae";
13 rev = "v${version}";
14 hash = "sha256-WiJqhXYehuUCLEuVbsQkmTntuH1srtePtZgYBSTbxiw=";
15 fetchSubmodules = true;
16 };
17
18 vendorHash = "sha256-fb4PEMhV8+5zaRJyl+nYi2BHcOUDUVAwxce2xaRt5JA=";
19
20 proxyVendor = true;
21
22 nativeBuildInputs = [ clang ];
23
24 ldflags = [
25 "-s"
26 "-w"
27 "-X github.com/daeuniverse/dae/cmd.Version=${version}"
28 "-X github.com/daeuniverse/dae/common/consts.MaxMatchSetLen_=64"
29 ];
30
31 preBuild = ''
32 make CFLAGS="-D__REMOVE_BPF_PRINTK -fno-stack-protector -Wno-unused-command-line-argument" \
33 NOSTRIP=y \
34 ebpf
35 '';
36
37 # network required
38 doCheck = false;
39
40 postInstall = ''
41 install -Dm444 install/dae.service $out/lib/systemd/system/dae.service
42 substituteInPlace $out/lib/systemd/system/dae.service \
43 --replace /usr/bin/dae $out/bin/dae
44 '';
45
46 meta = with lib; {
47 description = "A Linux high-performance transparent proxy solution based on eBPF";
48 homepage = "https://github.com/daeuniverse/dae";
49 license = licenses.agpl3Only;
50 maintainers = with maintainers; [ oluceps pokon548 ];
51 platforms = platforms.linux;
52 mainProgram = "dae";
53 };
54}