Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
73 lines
1.7 KiB
Nix
73 lines
1.7 KiB
Nix
{
|
|
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";
|
|
};
|
|
})
|