at v206 2.2 kB view raw
1{ stdenv, fetchFromGitHub, fetchpatch, makeWrapper, pandoc 2, coreutils, iptables, nettools, openssh, procps, pythonPackages }: 3 4let version = "0.71"; in 5stdenv.mkDerivation rec { 6 name = "sshuttle-${version}"; 7 8 src = fetchFromGitHub { 9 sha256 = "0yr8nih97jg6azfj3k7064lfbh3g36l6vwyjlngl4ph6mgcki1cm"; 10 rev = name; 11 repo = "sshuttle"; 12 owner = "sshuttle"; 13 }; 14 15 patches = [ 16 (fetchpatch { 17 sha256 = "1yrjyvdz6k6zk020dmbagf8w49w8vhfbzgfpsq9jqdh2hbykv3m3"; 18 url = https://github.com/sshuttle/sshuttle/commit/3cf5002b62650c26a50e18af8d8c5c91d754bab9.patch; 19 }) 20 (fetchpatch { 21 sha256 = "091gg28cnmx200q46bcnxpp9ih9p5qlq0r3bxfm0f4qalg8rmp2g"; 22 url = https://github.com/sshuttle/sshuttle/commit/d70b5f2b89e593506834cf8ea10785d96c801dfc.patch; 23 }) 24 (fetchpatch { 25 sha256 = "17l9h8clqlbyxdkssavxqpb902j7b3yabrrdalybfpkhj69x8ghk"; 26 url = https://github.com/sshuttle/sshuttle/commit/a38963301e9c29fbe3232f0a41ea080b642c5ad2.patch; 27 }) 28 ]; 29 30 nativeBuildInputs = [ makeWrapper pandoc ]; 31 buildInputs = 32 [ coreutils iptables nettools openssh procps pythonPackages.python ]; 33 pythonPaths = with pythonPackages; [ PyXAPI ]; 34 35 preConfigure = '' 36 cd src 37 ''; 38 39 installPhase = let 40 mapPath = f: x: stdenv.lib.concatStringsSep ":" (map f x); 41 in '' 42 mkdir -p $out/share/sshuttle 43 cp -R sshuttle *.py compat $out/share/sshuttle 44 45 mkdir -p $out/bin 46 ln -s $out/share/sshuttle/sshuttle $out/bin 47 wrapProgram $out/bin/sshuttle \ 48 --prefix PATH : "${mapPath (x: "${x}/bin") buildInputs}" \ 49 --prefix PYTHONPATH : "${mapPath (x: "$(toPythonPath ${x})") pythonPaths}" 50 51 install -Dm644 sshuttle.8 $out/share/man/man8/sshuttle.8 52 ''; 53 54 meta = with stdenv.lib; { 55 inherit version; 56 inherit (src.meta) homepage; 57 description = "Transparent proxy server that works as a poor man's VPN"; 58 longDescription = '' 59 Forward connections over SSH, without requiring administrator access to the 60 target network (though it does require Python 2 at both ends). 61 Works with Linux and Mac OS and supports DNS tunneling. 62 ''; 63 maintainers = with maintainers; [ iElectric nckx ]; 64 platforms = platforms.unix; 65 }; 66}