Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, fetchpatch, libpcap, pkg-config, openssl, lua5_3 2, pcre, libssh2 3, libX11 ? null 4, gtk2 ? null 5, makeWrapper ? null 6, withLua ? true 7}: 8 9stdenv.mkDerivation rec { 10 pname = "nmap"; 11 version = "7.93"; 12 13 src = fetchurl { 14 url = "https://nmap.org/dist/nmap-${version}.tar.bz2"; 15 sha256 = "sha256-Vbz+R5PiWsyWukJ02MQijbVQuOjv1yAEs47FWi3RZlE="; 16 }; 17 18 patches = [ ./zenmap.patch ] 19 ++ lib.optionals stdenv.cc.isClang [( 20 # Fixes a compile error due an ambiguous reference to bind(2) in 21 # nping/EchoServer.cc, which is otherwise resolved to std::bind. 22 # https://github.com/nmap/nmap/pull/1363 23 fetchpatch { 24 url = "https://github.com/nmap/nmap/commit/5bbe66f1bd8cbd3718f5805139e2e8139e6849bb.diff"; 25 includes = [ "nping/EchoServer.cc" ]; 26 sha256 = "0xcph9mycy57yryjg253frxyz87c4135rrbndlqw1400c8jxq70c"; 27 } 28 )]; 29 30 prePatch = lib.optionalString stdenv.isDarwin '' 31 substituteInPlace libz/configure \ 32 --replace /usr/bin/libtool ar \ 33 --replace 'AR="libtool"' 'AR="ar"' \ 34 --replace 'ARFLAGS="-o"' 'ARFLAGS="-r"' 35 ''; 36 37 configureFlags = [ 38 (if withLua then "--with-liblua=${lua5_3}" else "--without-liblua") 39 "--with-liblinear=included" 40 "--without-ndiff" 41 "--without-zenmap" 42 ]; 43 44 makeFlags = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ 45 "AR=${stdenv.cc.bintools.targetPrefix}ar" 46 "RANLIB=${stdenv.cc.bintools.targetPrefix}ranlib" 47 "CC=${stdenv.cc.targetPrefix}gcc" 48 ]; 49 50 nativeBuildInputs = [ pkg-config ]; 51 buildInputs = [ pcre libssh2 libpcap openssl ]; 52 53 enableParallelBuilding = true; 54 55 doCheck = false; # fails 3 tests, probably needs the net 56 57 meta = with lib; { 58 description = "A free and open source utility for network discovery and security auditing"; 59 homepage = "http://www.nmap.org"; 60 license = licenses.gpl2; 61 platforms = platforms.all; 62 maintainers = with maintainers; [ thoughtpolice fpletz ]; 63 }; 64}