1{
2 fetchFromGitHub,
3 rustPlatform,
4 fetchurl,
5 lib,
6}:
7
8rustPlatform.buildRustPackage rec {
9 pname = "moproxy";
10 version = "0.5.1";
11
12 src = fetchFromGitHub {
13 owner = "sorz";
14 repo = "moproxy";
15 rev = "v${version}";
16 hash = "sha256-Rqno+cg44IWBJbKWUP6BnxzwCjuNhFo9nBF6u2jlyA4=";
17 };
18
19 cargoHash = "sha256-SJHsXck2f9xJZ4GmOkISjdfqxlF4LCAH9WYjqSqFFkE=";
20
21 preBuild =
22 let
23 webBundle = fetchurl {
24 url = "https://github.com/sorz/moproxy-web/releases/download/v0.1.8/build.zip";
25 hash = "sha256-bLC76LnTWR2/xnDcZtX/t0OUmP7vdI/o3TCRzG9eH/g=";
26 };
27 in
28 ''
29 # build script try to download from network
30 sed -i '15s/.*/let zip_path = PathBuf::from("${
31 lib.escape [ "/" ] (toString webBundle)
32 }");/' build.rs
33 '';
34
35 meta = with lib; {
36 homepage = "https://github.com/sorz/moproxy";
37 description = "Transparent TCP to SOCKSv5/HTTP proxy on Linux written in Rust";
38 license = licenses.mit;
39 mainProgram = "moproxy";
40 maintainers = with maintainers; [ oluceps ];
41 platforms = platforms.linux;
42 };
43}