nmap: pin to Python 2, make Python optional
Python 3 is not supported, so use python2Packages. Python is only required for the `ndiff` and `zenmap` binaries, not the main `nmap` binary, so disable Python by default to reduce the default closure size, and add a `withPython` arg to re-enable it. Note that Zenmap is the graphical program, so passing `graphicalSupport = true` will also automatically enable Python support.
This commit is contained in:
parent
c8dba2581c
commit
6321a1b67c
@ -2,14 +2,21 @@
|
|||||||
, graphicalSupport ? false
|
, graphicalSupport ? false
|
||||||
, libX11 ? null
|
, libX11 ? null
|
||||||
, gtk2 ? null
|
, gtk2 ? null
|
||||||
, pythonPackages
|
, withPython ? false # required for the `ndiff` binary
|
||||||
|
, python2Packages ? null
|
||||||
, makeWrapper ? null
|
, makeWrapper ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
assert withPython -> python2Packages != null;
|
||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (pythonPackages) python pygtk pygobject2 pycairo pysqlite;
|
|
||||||
|
# Zenmap (the graphical program) also requires Python,
|
||||||
|
# so automatically enable pythonSupport if graphicalSupport is requested.
|
||||||
|
pythonSupport = withPython || graphicalSupport;
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
name = "nmap${optionalString graphicalSupport "-graphical"}-${version}";
|
name = "nmap${optionalString graphicalSupport "-graphical"}-${version}";
|
||||||
version = "7.12";
|
version = "7.12";
|
||||||
@ -21,15 +28,19 @@ in stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
patches = ./zenmap.patch;
|
patches = ./zenmap.patch;
|
||||||
|
|
||||||
configureFlags = optionalString (!graphicalSupport) "--without-zenmap";
|
configureFlags = []
|
||||||
|
++ optional (!pythonSupport) "--without-ndiff"
|
||||||
|
++ optional (!graphicalSupport) "--without-zenmap"
|
||||||
|
;
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = optionalString pythonSupport ''
|
||||||
wrapProgram $out/bin/ndiff --prefix PYTHONPATH : "$(toPythonPath $out)" --prefix PYTHONPATH : "$PYTHONPATH"
|
wrapProgram $out/bin/ndiff --prefix PYTHONPATH : "$(toPythonPath $out)" --prefix PYTHONPATH : "$PYTHONPATH"
|
||||||
'' + optionalString graphicalSupport ''
|
'' + optionalString graphicalSupport ''
|
||||||
wrapProgram $out/bin/zenmap --prefix PYTHONPATH : "$(toPythonPath $out)" --prefix PYTHONPATH : "$PYTHONPATH" --prefix PYTHONPATH : $(toPythonPath ${pygtk})/gtk-2.0 --prefix PYTHONPATH : $(toPythonPath ${pygobject2})/gtk-2.0 --prefix PYTHONPATH : $(toPythonPath ${pycairo})/gtk-2.0
|
wrapProgram $out/bin/zenmap --prefix PYTHONPATH : "$(toPythonPath $out)" --prefix PYTHONPATH : "$PYTHONPATH" --prefix PYTHONPATH : $(toPythonPath $pygtk)/gtk-2.0 --prefix PYTHONPATH : $(toPythonPath $pygobject)/gtk-2.0 --prefix PYTHONPATH : $(toPythonPath $pycairo)/gtk-2.0
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildInputs = [ libpcap pkgconfig openssl makeWrapper python ]
|
buildInputs = with python2Packages; [ libpcap pkgconfig openssl ]
|
||||||
|
++ optionals pythonSupport [ makeWrapper python ]
|
||||||
++ optionals graphicalSupport [
|
++ optionals graphicalSupport [
|
||||||
libX11 gtk2 pygtk pysqlite pygobject2 pycairo
|
libX11 gtk2 pygtk pysqlite pygobject2 pycairo
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user