nixpkgs/pkgs/tools/networking/sing-box/default.nix

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

64 lines
1.4 KiB
Nix
Raw Normal View History

2022-12-28 07:44:35 +00:00
{ lib
2022-12-28 09:39:42 +00:00
, stdenv
2022-12-28 07:44:35 +00:00
, buildGoModule
, fetchFromGitHub
2022-12-28 09:39:42 +00:00
, installShellFiles
, buildPackages
2023-03-27 01:22:58 +00:00
, nix-update-script
2022-12-28 07:44:35 +00:00
}:
buildGoModule rec {
pname = "sing-box";
2023-05-20 03:33:29 +00:00
version = "1.2.7";
2022-12-28 07:44:35 +00:00
src = fetchFromGitHub {
owner = "SagerNet";
repo = pname;
rev = "v${version}";
2023-05-20 03:33:29 +00:00
hash = "sha256-+pRG5nq0Be58at61qqu5QciHC2DMvw+wj7u8tZx8+eY=";
2022-12-28 07:44:35 +00:00
};
2023-05-20 03:33:29 +00:00
vendorHash = "sha256-gHPMJ4/W2ZisG/jAtHSLH/NlHgBitg7Bwe95wGJAsOY=";
2022-12-28 07:44:35 +00:00
tags = [
"with_quic"
"with_grpc"
"with_dhcp"
2022-12-28 07:44:35 +00:00
"with_wireguard"
"with_shadowsocksr"
"with_ech"
"with_utls"
"with_reality_server"
2022-12-28 07:44:35 +00:00
"with_acme"
"with_clash_api"
"with_v2ray_api"
"with_gvisor"
];
subPackages = [
"cmd/sing-box"
];
2022-12-28 09:39:42 +00:00
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-X=github.com/sagernet/sing-box/constant.Version=${version}"
];
2022-12-28 09:39:42 +00:00
postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in ''
installShellCompletion --cmd sing-box \
--bash <(${emulator} $out/bin/sing-box completion bash) \
--fish <(${emulator} $out/bin/sing-box completion fish) \
--zsh <(${emulator} $out/bin/sing-box completion zsh )
'';
2023-03-27 01:22:58 +00:00
passthru.updateScript = nix-update-script { };
2022-12-28 07:44:35 +00:00
meta = with lib;{
homepage = "https://sing-box.sagernet.org";
description = "The universal proxy platform";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ nickcao ];
};
}