diff options
author | hexclover <47456195+hexclover@users.noreply.github.com> | 2023-12-07 15:19:00 +0800 |
---|---|---|
committer | Matthieu Coudron <886074+teto@users.noreply.github.com> | 2023-12-22 19:15:14 +0100 |
commit | 66bda599f409f9834c6fd6abc602e452a5c16b61 (patch) | |
tree | 914a7eafeb56f074a6012ce0059f34a68273eaa0 /pkgs | |
parent | ea8bb2df93b9b8db2619328e690da962eaf99862 (diff) |
mininet, nixos/mininet: Wrap executables in the package, not the module
Also move the `mn` executable from the Python module to the main package.
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/tools/virtualization/mininet/default.nix | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/pkgs/tools/virtualization/mininet/default.nix b/pkgs/tools/virtualization/mininet/default.nix index c33389861dd0a..3d7339bf56b63 100644 --- a/pkgs/tools/virtualization/mininet/default.nix +++ b/pkgs/tools/virtualization/mininet/default.nix @@ -1,11 +1,38 @@ { stdenv, lib, fetchFromGitHub +, runCommand , which , python3 , help2man +, makeWrapper +, ethtool +, inetutils +, iperf +, iproute2 +, nettools +, socat }: let pyEnv = python3.withPackages(ps: [ ps.setuptools ]); + + 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 + ]; + in stdenv.mkDerivation rec { pname = "mininet"; @@ -24,7 +51,7 @@ stdenv.mkDerivation rec { makeFlags = [ "PREFIX=$(out)" ]; pythonPath = [ python3.pkgs.setuptools ]; - nativeBuildInputs = [ help2man ]; + nativeBuildInputs = [ help2man makeWrapper python3.pkgs.wrapPython ]; propagatedBuildInputs = [ python3 which ]; @@ -33,7 +60,18 @@ stdenv.mkDerivation rec { preInstall = '' mkdir -p $out $py # without --root, install fails - ${pyEnv.interpreter} setup.py install --root="/" --prefix=$py + "${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}" ''; doCheck = false; |