1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 04:02:10 +00:00
nixpkgs/nixos/modules/programs/mininet.nix
Artturin 6910a4eea0 treewide: makeWrapper to nativeBuildInputs
this should be all of them other than the failed splices
found with nixpkgs-lint
2022-09-26 17:53:26 +03:00

40 lines
999 B
Nix

# Global configuration for mininet
# kernel must have NETNS/VETH/SCHED
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.mininet;
generatedPath = with pkgs; makeSearchPath "bin" [
iperf ethtool iproute2 socat
];
pyEnv = pkgs.python.withPackages(ps: [ ps.mininet-python ]);
mnexecWrapped = pkgs.runCommand "mnexec-wrapper"
{ nativeBuildInputs = [ pkgs.makeWrapper pkgs.pythonPackages.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
'';
in
{
options.programs.mininet.enable = mkEnableOption (lib.mdDoc "Mininet");
config = mkIf cfg.enable {
virtualisation.vswitch.enable = true;
environment.systemPackages = [ mnexecWrapped ];
};
}