1{
2 lib,
3 stdenv,
4 buildPythonApplication,
5 nix-update-script,
6 fetchFromGitHub,
7 dnspython,
8 iproute2,
9 iptables,
10 setproctitle,
11 setuptools,
12 unixtools,
13}:
14
15buildPythonApplication rec {
16 pname = "vpn-slice";
17 version = "0.16.1";
18 pyproject = true;
19
20 src = fetchFromGitHub {
21 owner = "dlenski";
22 repo = "vpn-slice";
23 rev = "v${version}";
24 sha256 = "sha256-T6VULLNRLWO4OcAsuTmhty6H4EhinyxQSg0dfv2DUJs=";
25 };
26
27 postPatch =
28 lib.optionalString stdenv.hostPlatform.isDarwin ''
29 substituteInPlace vpn_slice/mac.py \
30 --replace-fail "'/sbin/route'" "'${unixtools.route}/bin/route'"
31 ''
32 + lib.optionalString stdenv.hostPlatform.isLinux ''
33 substituteInPlace vpn_slice/linux.py \
34 --replace-fail "'/sbin/ip'" "'${iproute2}/bin/ip'" \
35 --replace-fail "'/sbin/iptables'" "'${iptables}/bin/iptables'"
36 '';
37
38 build-system = [
39 setuptools
40 ];
41
42 dependencies = [
43 setuptools # can be removed with next package update, upstream no longer has a dependency on distutils
44 setproctitle
45 dnspython
46 ];
47
48 doCheck = false;
49
50 passthru = {
51 updateScript = nix-update-script { };
52 };
53
54 meta = with lib; {
55 homepage = "https://github.com/dlenski/vpn-slice";
56 description = "vpnc-script replacement for easy and secure split-tunnel VPN setup";
57 mainProgram = "vpn-slice";
58 license = licenses.gpl3;
59 maintainers = [ ];
60 };
61}