1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 # "dlsym" for OSX version < 12
7 darwinHookMethod ? "dyld",
8}:
9
10stdenv.mkDerivation rec {
11 pname = "proxychains-ng";
12 version = "4.17";
13
14 src = fetchFromGitHub {
15 owner = "rofl0r";
16 repo = "proxychains-ng";
17 rev = "v${version}";
18 sha256 = "sha256-cHRWPQm6aXsror0z+S2Ddm7w14c1OvEruDublWsvnXs=";
19 };
20
21 patches = [
22 # https://github.com/NixOS/nixpkgs/issues/136093
23 ./swap-priority-4-and-5-in-get_config_path.patch
24 # The fix is not present in v4.17; remove the patch next version update.
25 # https://github.com/rofl0r/proxychains-ng/issues/557
26 (fetchpatch {
27 url = "https://github.com/rofl0r/proxychains-ng/commit/fffd2532ad34bdf7bf430b128e4c68d1164833c6.patch";
28 hash = "sha256-l3qSFUDMUfVDW1Iw+R2aW/wRz4CxvpR4eOwx9KzuAAo=";
29 })
30 ];
31
32 configureFlags = lib.optionals stdenv.hostPlatform.isDarwin [
33 "--hookmethod=${darwinHookMethod}"
34 ];
35
36 installFlags = [
37 "install-config"
38 "install-zsh-completion"
39 ];
40
41 meta = with lib; {
42 description = "Preloader which hooks calls to sockets in dynamically linked programs and redirects it through one or more socks/http proxies";
43 homepage = "https://github.com/rofl0r/proxychains-ng";
44 license = licenses.gpl2Plus;
45 maintainers = with maintainers; [
46 zenithal
47 usertam
48 ];
49 platforms = platforms.unix;
50 mainProgram = "proxychains4";
51 };
52}