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