diff --git a/pkgs/tools/networking/tcng/default.nix b/pkgs/tools/networking/tcng/default.nix new file mode 100644 index 000000000000..289b7bde723a --- /dev/null +++ b/pkgs/tools/networking/tcng/default.nix @@ -0,0 +1,76 @@ +args: with args; + +# tcc can even compile kernel modules for speed reason. +# that would be a nice use case to test! + +let version = "10b"; in + +args.stdenv.mkDerivation { + + name = "tcng-${version}"; + + src = fetchurl { + url = mirror://debian/pool/main/t/tcng/tcng_10b.orig.tar.gz; + sha256 = "1xjs0yn90rfa8ibxybg3gab1xzcjg60njymq2bd1b0a9i0arx7ji"; + }; + + iproute2Src=iproute.src; + + patches = [ + (fetchurl { + url = mirror://debian/pool/main/t/tcng/tcng_10b-2.diff.gz; + sha256 = "17i4s2ffif0k4b78gfhkp08lvvharbfvyhwbd0vkwgpria0b9zrd"; + })]; + + # one mailinglist post says you should just add your kernel version to the list.. (?) + patchPhase = '' + unset patchPhase + patchPhase + unpackFile $iproute2Src + IPROUTESRC=$(echo iproute*) + for script in $(find . -type f); do sed -e 's@#![ ]*/bin/bash@#! /bin/sh@' -i $script; done + find . -type f | xargs sed -i 's@/usr/bin/perl@${perl}/bin/perl@g' + ''; + + + # gentoo ebulid says tcsim doesn't compile with 2.6 headers.. + # DATADIR can stillb e overridden by env TOPDIR=... + configurePhase='' + cat >> config << EOF + YACC="yacc" + DATA_DIR="/tmp/tcng/where_is_this_used" + EOF + ./configure \ + --kernel ${kernel}/lib/modules/2.6.28.6-default/build \ + --iproute2 $IPROUTESRC \ + --install-directory $out \ + --no-manual \ + --with-tcsim + ''; + + + # hacky, how to enable building tcc the correct way? + # adding shared and tcc to SUBDIRS and run make again isn't nice but works + buildPhase = '' + sed -i 's@^\(SUBDIRS.*\)@\1 shared tcc@' Makefile + make; + ''; + + installPhase = '' + ensureDir $out{,/sbin} + make DESTDIR=$out install + cp tcc/tcc $out/sbin + ''; + + buildInputs =(with args; [bison flex db4 perl]); + + meta = { + description="tcng - Traffic Control Next Generation"; + homepage = "http://tcng.sourceforge.net/"; + license = "GPLv2"; + longDescription = '' + useful links: http://linux-ip.net/articles/Traffic-Control-HOWTO, + http://blog.edseek.com/~jasonb/articles/traffic_shaping/ + ''; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1ba12ebd8855..276c86631968 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1229,6 +1229,11 @@ let inherit fetchurl stdenv libpcap; }; + tcng = import ../tools/networking/tcng { + inherit fetchurl stdenv iproute bison flex db4 perl; + kernel = kernel_2_6_28; + }; + telnet = import ../tools/networking/telnet { inherit fetchurl stdenv ncurses; };