nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 openvpn,
6 iproute2,
7 iptables,
8 util-linux,
9}:
10
11buildPythonPackage rec {
12 pname = "namespaced-openvpn";
13 version = "0.6.0";
14 format = "other";
15
16 src = fetchFromGitHub {
17 owner = "slingamn";
18 repo = pname;
19 rev = "a3fa42b2d8645272cbeb6856e26a7ea9547cb7d1";
20 sha256 = "+Fdaw9EGyFGH9/DSeVJczS8gPzAOv+qn+1U20zQBBqQ=";
21 };
22
23 buildInputs = [
24 openvpn
25 iproute2
26 util-linux
27 ];
28
29 postPatch = ''
30 substituteInPlace namespaced-openvpn \
31 --replace-fail "/usr/sbin/openvpn" "${openvpn}/bin/openvpn" \
32 --replace-fail "/sbin/ip" "${iproute2}/bin/ip" \
33 --replace-fail "/usr/bin/nsenter" "${util-linux}/bin/nsenter" \
34 --replace-fail "/bin/mount" "${util-linux}/bin/mount" \
35 --replace-fail "/bin/umount" "${util-linux}/bin/umount"
36
37 substituteInPlace seal-unseal-gateway \
38 --replace-fail "/sbin/iptables" "${iptables}/bin/iptables"
39 '';
40
41 dontBuild = true;
42 doCheck = false;
43
44 installPhase = ''
45 mkdir -p $out/bin
46 cp namespaced-openvpn seal-unseal-gateway $out/bin
47 '';
48
49 meta = with lib; {
50 homepage = "https://github.com/slingamn/namespaced-openvpn";
51 description = "Network namespace isolation for OpenVPN tunnels";
52 license = licenses.mit;
53 maintainers = [ maintainers.lodi ];
54 platforms = platforms.linux;
55 mainProgram = "namespaced-openvpn";
56 };
57}