about summary refs log tree commit diff
path: root/pkgs/by-name/op/openvswitch/generic.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/op/openvswitch/generic.nix')
-rw-r--r--pkgs/by-name/op/openvswitch/generic.nix56
1 files changed, 40 insertions, 16 deletions
diff --git a/pkgs/by-name/op/openvswitch/generic.nix b/pkgs/by-name/op/openvswitch/generic.nix
index b3c00ab18203e..95fea77f8d1e5 100644
--- a/pkgs/by-name/op/openvswitch/generic.nix
+++ b/pkgs/by-name/op/openvswitch/generic.nix
@@ -20,23 +20,29 @@
   pkg-config,
   procps,
   python3,
+  tcpdump,
   sphinxHook,
   util-linux,
   which,
   writeScript,
+  makeWrapper,
+  withDPDK ? false,
+  dpdk,
+  numactl,
+  libpcap,
 }:
 
 let
   _kernel = kernel;
 in
 stdenv.mkDerivation rec {
-  pname = "openvswitch";
+  pname = if withDPDK then "openvswitch-dpdk" else "openvswitch";
   inherit version;
 
   kernel = lib.optional (_kernel != null) _kernel.dev;
 
   src = fetchurl {
-    url = "https://www.openvswitch.org/releases/${pname}-${version}.tar.gz";
+    url = "https://www.openvswitch.org/releases/openvswitch-${version}.tar.gz";
     inherit hash;
   };
 
@@ -60,29 +66,39 @@ stdenv.mkDerivation rec {
     libtool
     pkg-config
     sphinxHook
+    makeWrapper
   ];
 
   sphinxBuilders = [ "man" ];
 
   sphinxRoot = "./Documentation";
 
-  buildInputs = [
-    libcap_ng
-    openssl
-    perl
-    procps
-    python3
-    util-linux
-    which
-  ];
+  buildInputs =
+    [
+      libcap_ng
+      openssl
+      perl
+      procps
+      python3
+      util-linux
+      which
+    ]
+    ++ (lib.optionals withDPDK [
+      dpdk
+      numactl
+      libpcap
+    ]);
 
   preConfigure = "./boot.sh";
 
-  configureFlags = [
-    "--localstatedir=/var"
-    "--sharedstatedir=/var"
-    "--sbindir=$(out)/bin"
-  ] ++ (lib.optionals (_kernel != null) [ "--with-linux" ]);
+  configureFlags =
+    [
+      "--localstatedir=/var"
+      "--sharedstatedir=/var"
+      "--sbindir=$(out)/bin"
+    ]
+    ++ (lib.optionals (_kernel != null) [ "--with-linux" ])
+    ++ (lib.optionals withDPDK [ "--with-dpdk=shared" ]);
 
   # Leave /var out of this!
   installFlags = [
@@ -96,6 +112,13 @@ stdenv.mkDerivation rec {
   postInstall = ''
     installShellCompletion --bash utilities/ovs-appctl-bashcomp.bash
     installShellCompletion --bash utilities/ovs-vsctl-bashcomp.bash
+
+    wrapProgram $out/bin/ovs-l3ping \
+      --prefix PYTHONPATH : $out/share/openvswitch/python
+
+    wrapProgram $out/bin/ovs-tcpdump \
+      --prefix PATH : ${lib.makeBinPath [ tcpdump ]} \
+      --prefix PYTHONPATH : $out/share/openvswitch/python
   '';
 
   doCheck = true;
@@ -138,6 +161,7 @@ stdenv.mkDerivation rec {
       adamcstephens
       kmcopper
       netixx
+      xddxdd
     ];
     platforms = platforms.linux;
   };