1{ lib, stdenv, fetchFromGitHub, rustPlatform, pkg-config, openssl, Security, CoreServices }:
2
3rustPlatform.buildRustPackage rec {
4 pname = "shadowsocks-rust";
5 version = "1.16.1";
6
7 src = fetchFromGitHub {
8 rev = "v${version}";
9 owner = "shadowsocks";
10 repo = pname;
11 hash = "sha256-h/2zHxgp8sXcUOpmtneoAX0hNt19pObfyGW3wIzQNxc=";
12 };
13
14 cargoHash = "sha256-MZGd1SyTSZ6y9W9h+M3Y5cwX6hLCFiuPZb307PRtvQk=";
15
16 nativeBuildInputs = lib.optionals stdenv.isLinux [ pkg-config ];
17
18 buildInputs = lib.optionals stdenv.isLinux [ openssl ]
19 ++ lib.optionals stdenv.isDarwin [ Security CoreServices ];
20
21 buildFeatures = [
22 "trust-dns"
23 "local-http-native-tls"
24 "local-tunnel"
25 "local-socks4"
26 "local-redir"
27 "local-dns"
28 "local-tun"
29 "aead-cipher-extra"
30 "aead-cipher-2022"
31 "aead-cipher-2022-extra"
32 ];
33
34 # all of these rely on connecting to www.example.com:80
35 checkFlags = [
36 "--skip=http_proxy"
37 "--skip=tcp_tunnel"
38 "--skip=tcprelay"
39 "--skip=udp_tunnel"
40 "--skip=udp_relay"
41 "--skip=socks4_relay_connect"
42 "--skip=socks5_relay_aead"
43 "--skip=socks5_relay_stream"
44 "--skip=trust_dns_resolver"
45 ];
46
47 # timeouts in sandbox
48 doCheck = false;
49
50 meta = with lib; {
51 description = "A Rust port of Shadowsocks";
52 homepage = "https://github.com/shadowsocks/shadowsocks-rust";
53 changelog = "https://github.com/shadowsocks/shadowsocks-rust/raw/v${version}/debian/changelog";
54 license = licenses.mit;
55 maintainers = [ maintainers.marsam ];
56 };
57}