From 496705197e9343cfc7fa87610feb29c513c1c821 Mon Sep 17 00:00:00 2001 From: hexclover <47456195+hexclover@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:22:15 +0800 Subject: [PATCH 1/2] mininet: 2.3.0 -> 2.3.1b4 Switched to Python 3. --- pkgs/tools/virtualization/mininet/default.nix | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkgs/tools/virtualization/mininet/default.nix b/pkgs/tools/virtualization/mininet/default.nix index 7372d51a62fa..c33389861dd0 100644 --- a/pkgs/tools/virtualization/mininet/default.nix +++ b/pkgs/tools/virtualization/mininet/default.nix @@ -9,7 +9,7 @@ let in stdenv.mkDerivation rec { pname = "mininet"; - version = "2.3.0"; + version = "2.3.1b4"; outputs = [ "out" "py" ]; @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { owner = "mininet"; repo = "mininet"; rev = version; - sha256 = "sha256-bCppmeB+zQMKTptnzhsXtl72XJXU3USo7cQgP1Z6SrY="; + hash = "sha256-Z7Vbfu0EJ4+rCpckXrt3hgxeB9N2nnyPIXgPBnpV4uw="; }; buildFlags = [ "mnexec" ]; @@ -41,9 +41,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "Emulator for rapid prototyping of Software Defined Networks"; - license = { - fullName = "Mininet 2.3.0 License"; - }; + license = licenses.bsd3; platforms = platforms.linux; homepage = "https://github.com/mininet/mininet"; maintainers = with maintainers; [ teto ]; From 4e6fc83b980ebd91d7cb3b24e5a2927f1d158520 Mon Sep 17 00:00:00 2001 From: hexclover <47456195+hexclover@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:29:51 +0800 Subject: [PATCH 2/2] nixos/mininet: wrap with mininet in PYTHONPATH and ifconfig in PATH --- nixos/modules/programs/mininet.nix | 33 +++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/nixos/modules/programs/mininet.nix b/nixos/modules/programs/mininet.nix index 02272729d233..01ffd811e70e 100644 --- a/nixos/modules/programs/mininet.nix +++ b/nixos/modules/programs/mininet.nix @@ -5,26 +5,39 @@ with lib; let - cfg = config.programs.mininet; + cfg = config.programs.mininet; - generatedPath = with pkgs; makeSearchPath "bin" [ - iperf ethtool iproute2 socat + telnet = pkgs.runCommand "inetutils-telnet" + { } + '' + mkdir -p $out/bin + ln -s ${pkgs.inetutils}/bin/telnet $out/bin + ''; + + generatedPath = with pkgs; 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 ]; - pyEnv = pkgs.python.withPackages(ps: [ ps.mininet-python ]); + pyEnv = pkgs.python3.withPackages (ps: [ ps.mininet-python ]); mnexecWrapped = pkgs.runCommand "mnexec-wrapper" - { nativeBuildInputs = [ pkgs.makeWrapper pkgs.pythonPackages.wrapPython ]; } + { nativeBuildInputs = [ pkgs.makeWrapper pkgs.python3Packages.wrapPython ]; } '' makeWrapper ${pkgs.mininet}/bin/mnexec \ $out/bin/mnexec \ --prefix PATH : "${generatedPath}" - ln -s ${pyEnv}/bin/mn $out/bin/mn - - # mn errors out without a telnet binary - # pkgs.inetutils brings an undesired ifconfig into PATH see #43105 - ln -s ${pkgs.inetutils}/bin/telnet $out/bin/telnet + makeWrapper ${pyEnv}/bin/mn \ + $out/bin/mn \ + --prefix PYTHONPATH : "${pyEnv}/${pyEnv.sitePackages}" \ + --prefix PATH : "${generatedPath}" ''; in {