Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
1.7 KiB
Nix
Raw Permalink Normal View History

2025-10-09 14:15:47 +02:00
{
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
coreutils,
nix-update-script,
nixosTests,
}:
buildGoModule (finalAttrs: {
pname = "sing-box";
version = "1.12.9";
src = fetchFromGitHub {
owner = "SagerNet";
repo = "sing-box";
tag = "v${finalAttrs.version}";
hash = "sha256-1sN1VE+3CMI/rDiADpPJFv9NsxOvulLjGTE38CQOJzo=";
};
vendorHash = "sha256-Cx9SD5FTiyISRpWxlUsxeGP1M39YJQrWpRPaK1o6H08=";
tags = [
"with_quic"
"with_dhcp"
"with_wireguard"
"with_utls"
"with_acme"
"with_clash_api"
"with_gvisor"
"with_tailscale"
];
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
install -Dm444 release/config/sing-box.rules $out/share/polkit-1/rules.d/sing-box.rules
install -Dm444 release/config/sing-box-split-dns.xml $out/share/dbus-1/system.d/sing-box-split-dns.conf
'';
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";
};
})