about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/vpn-slice/default.nix
blob: 75cfe2bba0e94dfd15ecfd6b7e4664c7eb314cec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ lib
, stdenv
, buildPythonApplication
, nix-update-script
, python3Packages
, fetchFromGitHub
, iproute2
, iptables
, unixtools
}:

buildPythonApplication rec {
  pname = "vpn-slice";
  version = "0.16.1";

  src = fetchFromGitHub {
    owner = "dlenski";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-T6VULLNRLWO4OcAsuTmhty6H4EhinyxQSg0dfv2DUJs=";
  };

  postPatch = lib.optionalString stdenv.isDarwin ''
    substituteInPlace vpn_slice/mac.py \
      --replace "'/sbin/route'" "'${unixtools.route}/bin/route'"
  '' + lib.optionalString stdenv.isLinux ''
    substituteInPlace vpn_slice/linux.py \
      --replace "'/sbin/ip'" "'${iproute2}/bin/ip'" \
      --replace "'/sbin/iptables'" "'${iptables}/bin/iptables'"
  '';

  propagatedBuildInputs = with python3Packages; [ setproctitle dnspython ];

  doCheck = false;

  passthru = {
    updateScript = nix-update-script { };
  };

  meta = with lib; {
    homepage = "https://github.com/dlenski/vpn-slice";
    description =
      "vpnc-script replacement for easy and secure split-tunnel VPN setup";
    license = licenses.gpl3;
    maintainers = with maintainers; [ liketechnik ];
  };
}