2018-11-22 00:33:10 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub
|
2023-12-07 08:19:00 +01:00
|
|
|
, runCommand
|
2018-11-22 00:33:10 +01:00
|
|
|
, which
|
2021-05-22 01:31:34 +02:00
|
|
|
, python3
|
2018-11-22 00:33:10 +01:00
|
|
|
, help2man
|
2023-12-07 08:19:00 +01:00
|
|
|
, makeWrapper
|
|
|
|
, ethtool
|
|
|
|
, inetutils
|
|
|
|
, iperf
|
|
|
|
, iproute2
|
|
|
|
, nettools
|
|
|
|
, socat
|
2018-11-22 00:33:10 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-05-22 01:31:34 +02:00
|
|
|
pyEnv = python3.withPackages(ps: [ ps.setuptools ]);
|
2023-12-07 08:19:00 +01:00
|
|
|
|
|
|
|
telnet = runCommand "inetutils-telnet"
|
|
|
|
{ }
|
|
|
|
''
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
ln -s "${inetutils}"/bin/telnet "$out/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
generatedPath = lib.makeSearchPath "bin" [
|
|
|
|
iperf
|
|
|
|
ethtool
|
|
|
|
iproute2
|
|
|
|
socat
|
|
|
|
# mn errors out without a telnet binary
|
|
|
|
# pkgs.inetutils brings an undesired ifconfig into PATH see #43105
|
|
|
|
nettools
|
|
|
|
telnet
|
|
|
|
];
|
|
|
|
|
2018-11-22 00:33:10 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-05 10:55:06 +02:00
|
|
|
pname = "mininet";
|
2023-11-27 04:22:15 +01:00
|
|
|
version = "2.3.1b4";
|
2018-11-22 00:33:10 +01:00
|
|
|
|
|
|
|
outputs = [ "out" "py" ];
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mininet";
|
|
|
|
repo = "mininet";
|
|
|
|
rev = version;
|
2023-11-27 04:22:15 +01:00
|
|
|
hash = "sha256-Z7Vbfu0EJ4+rCpckXrt3hgxeB9N2nnyPIXgPBnpV4uw=";
|
2018-11-22 00:33:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
buildFlags = [ "mnexec" ];
|
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
2021-05-22 01:31:34 +02:00
|
|
|
pythonPath = [ python3.pkgs.setuptools ];
|
2023-12-07 08:19:00 +01:00
|
|
|
nativeBuildInputs = [ help2man makeWrapper python3.pkgs.wrapPython ];
|
2021-05-22 01:31:34 +02:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ python3 which ];
|
2018-11-22 00:33:10 +01:00
|
|
|
|
|
|
|
installTargets = [ "install-mnexec" "install-manpages" ];
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
mkdir -p $out $py
|
|
|
|
# without --root, install fails
|
2023-12-07 08:19:00 +01:00
|
|
|
"${pyEnv.interpreter}" setup.py install \
|
|
|
|
--root="/" \
|
|
|
|
--prefix="$py" \
|
|
|
|
--install-scripts="$out/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
wrapPythonProgramsIn "$out/bin" "$py $pythonPath"
|
|
|
|
wrapProgram "$out/bin/mnexec" \
|
|
|
|
--prefix PATH : "${generatedPath}"
|
|
|
|
wrapProgram "$out/bin/mn" \
|
|
|
|
--prefix PATH : "${generatedPath}"
|
2018-11-22 00:33:10 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Emulator for rapid prototyping of Software Defined Networks";
|
2023-11-27 04:22:15 +01:00
|
|
|
license = licenses.bsd3;
|
2019-08-05 10:55:06 +02:00
|
|
|
platforms = platforms.linux;
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/mininet/mininet";
|
2018-11-22 00:33:10 +01:00
|
|
|
maintainers = with maintainers; [ teto ];
|
2023-11-23 22:09:35 +01:00
|
|
|
mainProgram = "mnexec";
|
2018-11-22 00:33:10 +01:00
|
|
|
};
|
|
|
|
}
|