summary refs log tree commit diff
path: root/pkgs/tools/networking/vpnc/default.nix
blob: 88ef6bd8e59af7f0683f9074d1760782a0be8bea (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
48
49
{ stdenv, fetchurl, nettools, libgcrypt, perl, gawk, makeWrapper }:

stdenv.mkDerivation rec {
  name = "vpnc-0.5.3";
  src = fetchurl {
    url = "http://www.unix-ag.uni-kl.de/~massar/vpnc/${name}.tar.gz";
    sha256 = "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6";
  };

  patches = [ ./makefile.patch ];

  # The `etc/vpnc/vpnc-script' script relies on `which' and on
  # `ifconfig' as found in net-tools (not GNU Inetutils).
  propagatedBuildInputs = [ nettools ];

  buildInputs = [libgcrypt perl makeWrapper];

  preConfigure = ''
    substituteInPlace "vpnc-script.in" \
      --replace "which" "type -P" \
      --replace "awk" "${gawk}/bin/awk"

    substituteInPlace "config.c" \
      --replace "/etc/vpnc/vpnc-script" "$out/etc/vpnc/vpnc-script"

    substituteInPlace "pcf2vpnc" \
      --replace "/usr/bin/perl" "${perl}/bin/perl"
  '';

  postInstall = ''
    for i in "$out/{bin,sbin}/"*
    do
      wrapProgram $i --prefix PATH :  \
        "${nettools}/bin:${nettools}/sbin"
    done

    mkdir -p $out/share/doc/vpnc
    cp README nortel.txt ChangeLog $out/share/doc/vpnc/
  '';

  meta = {
    homepage = "http://www.unix-ag.uni-kl.de/~massar/vpnc/";
    description = "virtual private network (VPN) client for Cisco's VPN concentrators";
    license = "GPLv2+";

    platforms = stdenv.lib.platforms.linux;
    maintainers = [ stdenv.lib.maintainers.simons ];
  };
}