1{ lib, stdenv, fetchurl, makeWrapper, pkg-config, util-linux, which
2, procps, libcap_ng, openssl, python3 , perl
3, kernel ? null }:
4
5with lib;
6
7let
8 _kernel = kernel;
9 pythonEnv = python3.withPackages (ps: with ps; [ six ]);
10in stdenv.mkDerivation rec {
11 version = "2.15.1";
12 pname = "openvswitch";
13
14 src = fetchurl {
15 url = "https://www.openvswitch.org/releases/${pname}-${version}.tar.gz";
16 sha256 = "0vgijwycf3wvzv9v811jrfr5rlwmihlxwpf16spl6k9n6zaswysw";
17 };
18
19 kernel = optional (_kernel != null) _kernel.dev;
20
21 nativeBuildInputs = [ pkg-config makeWrapper ];
22 buildInputs = [ util-linux openssl libcap_ng pythonEnv
23 perl procps which ];
24
25 configureFlags = [
26 "--localstatedir=/var"
27 "--sharedstatedir=/var"
28 "--sbindir=$(out)/bin"
29 ] ++ (optionals (_kernel != null) ["--with-linux"]);
30
31 # Leave /var out of this!
32 installFlags = [
33 "LOGDIR=$(TMPDIR)/dummy"
34 "RUNDIR=$(TMPDIR)/dummy"
35 "PKIDIR=$(TMPDIR)/dummy"
36 ];
37
38 postBuild = ''
39 # fix tests
40 substituteInPlace xenserver/opt_xensource_libexec_interface-reconfigure --replace '/usr/bin/env python' '${pythonEnv.interpreter}'
41 substituteInPlace vtep/ovs-vtep --replace '/usr/bin/env python' '${pythonEnv.interpreter}'
42 '';
43
44 enableParallelBuilding = true;
45 doCheck = false; # bash-completion test fails with "compgen: command not found"
46
47 meta = with lib; {
48 platforms = platforms.linux;
49 description = "A multilayer virtual switch";
50 longDescription =
51 ''
52 Open vSwitch is a production quality, multilayer virtual switch
53 licensed under the open source Apache 2.0 license. It is
54 designed to enable massive network automation through
55 programmatic extension, while still supporting standard
56 management interfaces and protocols (e.g. NetFlow, sFlow, SPAN,
57 RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to
58 support distribution across multiple physical servers similar
59 to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V.
60 '';
61 homepage = "https://www.openvswitch.org/";
62 license = licenses.asl20;
63 maintainers = with maintainers; [ netixx kmcopper ];
64 };
65}