depot/third_party/nixpkgs/pkgs/tools/networking/dae/default.nix
Default email 5e9e1146e1 Project import generated by Copybara.
GitOrigin-RevId: 18036c0be90f4e308ae3ebcab0e14aae0336fe42
2023-08-05 00:07:22 +02:00

64 lines
1.5 KiB
Nix

{ lib
, clang
, fetchFromGitHub
, symlinkJoin
, buildGoModule
, makeWrapper
, v2ray-geoip
, v2ray-domain-list-community
}:
buildGoModule rec {
pname = "dae";
version = "0.2.3";
src = fetchFromGitHub {
owner = "daeuniverse";
repo = "dae";
rev = "v${version}";
hash = "sha256-Fk3xpQ8xuZMPulMFZb5fnN0Tisk13XRx49vBN5coanQ=";
fetchSubmodules = true;
};
vendorHash = "sha256-sqcImm5BYTiUnBmcpWWMR1TuV877VE5gZ8Oth8AxjSg=";
proxyVendor = true;
nativeBuildInputs = [ clang makeWrapper ];
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;
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
'';
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;
};
}