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