nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 clang,
4 fetchFromGitHub,
5 buildGoModule,
6 versionCheckHook,
7 nixosTests,
8 nix-update-script,
9}:
10
11buildGoModule (finalAttrs: {
12 pname = "dae";
13 version = "1.0.0";
14
15 src = fetchFromGitHub {
16 owner = "daeuniverse";
17 repo = "dae";
18 tag = "v${finalAttrs.version}";
19 hash = "sha256-RpbWZEoGrCq3Py0hu6YDie6ErDTLS3oabqScPzhCtm0=";
20 fetchSubmodules = true;
21 };
22
23 vendorHash = "sha256-u2DCHmX7vRNWIQ2Ir3UrxPGduggEqoUr1rnkDfwsT0I=";
24
25 proxyVendor = true;
26
27 nativeBuildInputs = [ clang ];
28
29 hardeningDisable = [
30 "zerocallusedregs"
31 ];
32
33 buildPhase = ''
34 runHook preBuild
35
36 make CFLAGS="-D__REMOVE_BPF_PRINTK -fno-stack-protector -Wno-unused-command-line-argument" \
37 NOSTRIP=y \
38 VERSION=${finalAttrs.version} \
39 OUTPUT=$out/bin/dae
40
41 runHook postBuild
42 '';
43
44 # network required
45 doCheck = false;
46
47 postInstall = ''
48 install -Dm444 install/dae.service $out/lib/systemd/system/dae.service
49 substituteInPlace $out/lib/systemd/system/dae.service \
50 --replace-fail "/usr/bin/dae" "$out/bin/dae"
51 '';
52
53 doInstallCheck = true;
54
55 nativeInstallCheckInputs = [ versionCheckHook ];
56
57 passthru = {
58 tests = {
59 inherit (nixosTests) dae;
60 };
61 updateScript = nix-update-script { };
62 };
63
64 meta = {
65 description = "Linux high-performance transparent proxy solution based on eBPF";
66 homepage = "https://github.com/daeuniverse/dae";
67 license = lib.licenses.agpl3Only;
68 maintainers = with lib.maintainers; [
69 oluceps
70 pokon548
71 luochen1990
72 ];
73 platforms = lib.platforms.linux;
74 mainProgram = "dae";
75 };
76})