2023-04-12 12:48:02 +00:00
|
|
|
{ lib
|
|
|
|
, clang
|
|
|
|
, fetchFromGitHub
|
2023-08-04 22:07:22 +00:00
|
|
|
, symlinkJoin
|
2023-04-12 12:48:02 +00:00
|
|
|
, buildGoModule
|
2023-08-04 22:07:22 +00:00
|
|
|
, makeWrapper
|
|
|
|
, v2ray-geoip
|
|
|
|
, v2ray-domain-list-community
|
2023-04-12 12:48:02 +00:00
|
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "dae";
|
2023-08-04 22:07:22 +00:00
|
|
|
version = "0.2.3";
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "daeuniverse";
|
2023-08-04 22:07:22 +00:00
|
|
|
repo = "dae";
|
2023-04-12 12:48:02 +00:00
|
|
|
rev = "v${version}";
|
2023-08-04 22:07:22 +00:00
|
|
|
hash = "sha256-Fk3xpQ8xuZMPulMFZb5fnN0Tisk13XRx49vBN5coanQ=";
|
2023-04-12 12:48:02 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
vendorHash = "sha256-sqcImm5BYTiUnBmcpWWMR1TuV877VE5gZ8Oth8AxjSg=";
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
proxyVendor = true;
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
nativeBuildInputs = [ clang makeWrapper ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/daeuniverse/dae/cmd.Version=${version}"
|
|
|
|
"-X github.com/daeuniverse/dae/common/consts.MaxMatchSetLen_=64"
|
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
make CFLAGS="-D__REMOVE_BPF_PRINTK -fno-stack-protector" \
|
|
|
|
NOSTRIP=y \
|
|
|
|
ebpf
|
|
|
|
'';
|
|
|
|
|
|
|
|
# network required
|
|
|
|
doCheck = false;
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
assetsDrv = symlinkJoin {
|
|
|
|
name = "dae-assets";
|
|
|
|
paths = [ v2ray-geoip v2ray-domain-list-community ];
|
|
|
|
};
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
install -Dm444 install/dae.service $out/lib/systemd/system/dae.service
|
|
|
|
wrapProgram $out/bin/dae \
|
|
|
|
--suffix DAE_LOCATION_ASSET : $assetsDrv/share/v2ray
|
|
|
|
substituteInPlace $out/lib/systemd/system/dae.service \
|
|
|
|
--replace /usr/bin/dae $out/bin/dae
|
|
|
|
'';
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A Linux high-performance transparent proxy solution based on eBPF";
|
|
|
|
homepage = "https://github.com/daeuniverse/dae";
|
|
|
|
license = licenses.agpl3Only;
|
|
|
|
maintainers = with maintainers; [ oluceps ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|