1{ stdenv, python3Packages, fetchurl, makeWrapper, pandoc
2, coreutils, iptables, nettools, openssh, procps, fetchpatch }:
3
4python3Packages.buildPythonApplication rec {
5 name = "sshuttle-${version}";
6 version = "0.78.4";
7
8 src = fetchurl {
9 sha256 = "0pqk43kd7crqhg6qgnl8kapncwgw1xgaf02zarzypcw64kvdih9h";
10 url = "mirror://pypi/s/sshuttle/${name}.tar.gz";
11 };
12
13 patches = [ ./sudo.patch ];
14
15 nativeBuildInputs = [ makeWrapper python3Packages.setuptools_scm ] ++ stdenv.lib.optional (stdenv.hostPlatform.system != "i686-linux") pandoc;
16 buildInputs =
17 [ coreutils openssh procps nettools ]
18 ++ stdenv.lib.optionals stdenv.isLinux [ iptables ];
19
20 checkInputs = with python3Packages; [ mock pytest pytestrunner ];
21
22 postInstall = let
23 mapPath = f: x: stdenv.lib.concatStringsSep ":" (map f x);
24 in ''
25 wrapProgram $out/bin/sshuttle \
26 --prefix PATH : "${mapPath (x: "${x}/bin") buildInputs}" \
27 '';
28
29 meta = with stdenv.lib; {
30 homepage = https://github.com/sshuttle/sshuttle/;
31 description = "Transparent proxy server that works as a poor man's VPN";
32 longDescription = ''
33 Forward connections over SSH, without requiring administrator access to the
34 target network (though it does require Python 2 at both ends).
35 Works with Linux and Mac OS and supports DNS tunneling.
36 '';
37 license = licenses.gpl2;
38 maintainers = with maintainers; [ domenkozar ];
39 platforms = platforms.unix;
40 };
41}