depot/third_party/nixpkgs/pkgs/tools/networking/sing-box/default.nix
Default email 410b979fe2 Project import generated by Copybara.
GitOrigin-RevId: a64e169e396460d6b5763a1de1dd197df8421688
2023-03-24 01:07:29 +01:00

58 lines
1.3 KiB
Nix

{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, installShellFiles
, buildPackages
}:
buildGoModule rec {
pname = "sing-box";
version = "1.1.7";
src = fetchFromGitHub {
owner = "SagerNet";
repo = pname;
rev = "v${version}";
hash = "sha256-jovUK535vZeCgnnW+9/gjXwCkNLMXdiCJwWqFKCubcU=";
};
vendorHash = "sha256-WYMCsFX5/4H+Bc0KcxcPMjfz2wEXz3V4D0sww15AgvE=";
tags = [
"with_quic"
"with_grpc"
"with_wireguard"
"with_shadowsocksr"
"with_ech"
"with_utls"
"with_acme"
"with_clash_api"
"with_v2ray_api"
"with_gvisor"
];
subPackages = [
"cmd/sing-box"
];
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-X=github.com/sagernet/sing-box/constant.Version=${version}"
];
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 )
'';
meta = with lib;{
homepage = "https://sing-box.sagernet.org";
description = "The universal proxy platform";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ nickcao ];
};
}