71 lines
1.5 KiB
Nix
71 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
buildGoModule,
|
|
fetchFromGitHub,
|
|
installShellFiles,
|
|
coreutils,
|
|
nix-update-script,
|
|
nixosTests,
|
|
}:
|
|
|
|
buildGoModule (finalAttrs: {
|
|
pname = "sing-box";
|
|
version = "1.11.15";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "SagerNet";
|
|
repo = "sing-box";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-uqPV3PGk3hFpV1B8+htBG9x58RVWew0sBDUItpxyv8Q=";
|
|
};
|
|
|
|
vendorHash = "sha256-qZlnY0MxB4/ttgjuAroTfqGWqGRea549EyIjSxPAlOI=";
|
|
|
|
tags = [
|
|
"with_quic"
|
|
"with_dhcp"
|
|
"with_wireguard"
|
|
"with_ech"
|
|
"with_utls"
|
|
"with_reality_server"
|
|
"with_acme"
|
|
"with_clash_api"
|
|
"with_gvisor"
|
|
];
|
|
|
|
subPackages = [
|
|
"cmd/sing-box"
|
|
];
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
ldflags = [
|
|
"-X=github.com/sagernet/sing-box/constant.Version=${finalAttrs.version}"
|
|
];
|
|
|
|
postInstall = ''
|
|
installShellCompletion release/completions/sing-box.{bash,fish,zsh}
|
|
|
|
substituteInPlace release/config/sing-box{,@}.service \
|
|
--replace-fail "/usr/bin/sing-box" "$out/bin/sing-box" \
|
|
--replace-fail "/bin/kill" "${coreutils}/bin/kill"
|
|
install -Dm444 -t "$out/lib/systemd/system/" release/config/sing-box{,@}.service
|
|
'';
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script { };
|
|
tests = { inherit (nixosTests) sing-box; };
|
|
};
|
|
|
|
meta = {
|
|
homepage = "https://sing-box.sagernet.org";
|
|
description = "Universal proxy platform";
|
|
license = lib.licenses.gpl3Plus;
|
|
maintainers = with lib.maintainers; [
|
|
nickcao
|
|
prince213
|
|
];
|
|
mainProgram = "sing-box";
|
|
};
|
|
})
|