From d30797b8ac73d13797674147ff120bfcc20718d2 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Sun, 13 Apr 2008 08:23:58 +0000
Subject: [PATCH] Updated gw6c and cleaned up the expression

svn path=/nixpkgs/trunk/; revision=11614
---
 pkgs/os-specific/linux/gw6c/5.1.nix     | 39 +++++++++++++++++++++++++
 pkgs/os-specific/linux/gw6c/default.nix | 30 -------------------
 pkgs/top-level/all-packages.nix         |  5 ++--
 3 files changed, 42 insertions(+), 32 deletions(-)
 create mode 100644 pkgs/os-specific/linux/gw6c/5.1.nix
 delete mode 100644 pkgs/os-specific/linux/gw6c/default.nix

diff --git a/pkgs/os-specific/linux/gw6c/5.1.nix b/pkgs/os-specific/linux/gw6c/5.1.nix
new file mode 100644
index 000000000000..68797e3d26f3
--- /dev/null
+++ b/pkgs/os-specific/linux/gw6c/5.1.nix
@@ -0,0 +1,39 @@
+args : with args; 
+rec {
+  src = fetchurl {
+    url = http://go6.net/4105/file.asp?file_id=150;
+    sha256 = "07svw71wad1kwip7vnsdwcvlhhknqlx8v8kmdnrw11f6xg76w2ln";
+    name = "gateway6-client-5.1.tar.gz";
+  };
+
+  buildInputs = [nettools openssl procps];
+  configureFlags = [];
+  makeFlags = ["target=linux"];
+  installFlags = ["installdir=$out"];
+
+  /* doConfigure should be specified separately */
+  phaseNames = ["preBuild" "doMakeInstall"];
+
+  goSrcDir = "cd ../tspc-advanced";
+
+  preBuild = FullDepEntry (''
+    sed -e 's@/dev/net/tun@/dev/tun@' -i platform/linux/tsp_tun.c;
+    sed -e 's@/sbin/ifconfig@${nettools}/sbin/ifconfig@' -i template/linux.sh
+    sed -e 's@/sbin/route@${nettools}/sbin/route@' -i template/linux.sh
+    sed -e 's@/sbin/ip@${iproute}/sbin/ip@' -i template/linux.sh
+    sed -e 's@/sbin/sysctl@${procps}/sbin/sysctl@' -i template/linux.sh
+  '') ["minInit" "addInputs" "doUnpack"];
+      
+  name = "gateway6-client-" + version;
+  meta = {
+    description = "Gateway6 client - provides IPv6 tunnel";
+    longDescription = "
+      This package provides Gateway6 client (gw6c) daemon,
+      which connects to so called tunnel broker via IPv4 
+      network, and tunnels IPv6 packets through broker,
+      thus giving global IPv6 connectivity. You may need 
+      tun, ipv6 and sit modules.
+    ";
+    homepage = http://go6.net ;
+  };
+}
diff --git a/pkgs/os-specific/linux/gw6c/default.nix b/pkgs/os-specific/linux/gw6c/default.nix
deleted file mode 100644
index 6e84bc0a61ad..000000000000
--- a/pkgs/os-specific/linux/gw6c/default.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{stdenv, fetchurl, nettools, openssl, procps}:
-stdenv.mkDerivation {
-  name = "Gateway6-Client";
-
-  src = fetchurl {
-    name = "GateWay6-Client.tar.gz";
-    url = http://www.go6.net/4105/file.asp?file_id=142;
-    sha256 = "1578i6j3kq7g5f55gy1nksl4q0lxssdk39ilrgqjc20gb6k5j7j3";
-  };
-
-  setSourceRoot = "sourceRoot=$(echo tspc*/)";
-
-  preBuild = "sed -e 's@/dev/net/tun@/dev/tun@' -i platform/linux/tsp_tun.c;
-	sed -e 's@/sbin/@/var/run/current-system/sw/sbin/@' -i template/linux.sh";
-
-  makeFlags = "target=linux";
-  installFlags = "installdir=\$(out)";
-
-  buildInputs = [nettools openssl procps];
-
-  meta = {
-    description = "
-	Gateway6 client. Provides IPv6 tunnel (by default - using 
-	Freenet6 anonymous server, which means dynamic IPv6 address, 
-	but if you register at any tunnel broker you can easily 
-	enter you data in configuration.nix). You need also to enable
-	service \"gw6c\". And check that tun, ipv6 and sit are modprobed.
-";
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d6f2fbb15985..5fe4cdbb8be2 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -4457,9 +4457,10 @@ let pkgs = rec {
     inherit stdenv fetchurl kernel xlibs gtkLibs;
   };
 
-  gw6c = import ../os-specific/linux/gw6c {
-    inherit fetchurl stdenv nettools openssl procps;
+  gw6cFun = builderDefsPackage (selectVersion ../os-specific/linux/gw6c "5.1") {
+    inherit fetchurl stdenv nettools openssl procps iproute;
   };
+  gw6c = gw6cFun null;
 
   nss_ldap = import ../os-specific/linux/nss_ldap {
     inherit fetchurl stdenv openldap;