1{ version
2, hash
3}:
4
5{ lib
6, stdenv
7, fetchurl
8, autoconf
9, automake
10, installShellFiles
11, iproute2
12, kernel ? null
13, libcap_ng
14, libtool
15, openssl
16, perl
17, pkg-config
18, procps
19, python3
20, sphinxHook
21, util-linux
22, which
23}:
24
25let
26 _kernel = kernel;
27in stdenv.mkDerivation rec {
28 pname = "openvswitch";
29 inherit version;
30
31 kernel = lib.optional (_kernel != null) _kernel.dev;
32
33 src = fetchurl {
34 url = "https://www.openvswitch.org/releases/${pname}-${version}.tar.gz";
35 inherit hash;
36 };
37
38 outputs = [
39 "out"
40 "man"
41 ];
42
43 patches = [
44 # 8: vsctl-bashcomp - argument completion FAILED (completion.at:664)
45 ./patches/disable-bash-arg-completion-test.patch
46 ];
47
48 nativeBuildInputs = [
49 autoconf
50 automake
51 installShellFiles
52 libtool
53 pkg-config
54 sphinxHook
55 ];
56
57 sphinxBuilders = [
58 "man"
59 ];
60
61 sphinxRoot = "./Documentation";
62
63 buildInputs = [
64 libcap_ng
65 openssl
66 perl
67 procps
68 python3
69 util-linux
70 which
71 ];
72
73 preConfigure = "./boot.sh";
74
75 configureFlags = [
76 "--localstatedir=/var"
77 "--sharedstatedir=/var"
78 "--sbindir=$(out)/bin"
79 ] ++ (lib.optionals (_kernel != null) ["--with-linux"]);
80
81 # Leave /var out of this!
82 installFlags = [
83 "LOGDIR=$(TMPDIR)/dummy"
84 "RUNDIR=$(TMPDIR)/dummy"
85 "PKIDIR=$(TMPDIR)/dummy"
86 ];
87
88 enableParallelBuilding = true;
89
90 postInstall = ''
91 installShellCompletion --bash utilities/ovs-appctl-bashcomp.bash
92 installShellCompletion --bash utilities/ovs-vsctl-bashcomp.bash
93 '';
94
95 doCheck = true;
96 preCheck = ''
97 patchShebangs tests/
98 '';
99
100 nativeCheckInputs = [
101 iproute2
102 ] ++ (with python3.pkgs; [
103 netaddr
104 pyparsing
105 pytest
106 ]);
107
108 meta = with lib; {
109 changelog = "https://www.openvswitch.org/releases/NEWS-${version}.txt";
110 description = "A multilayer virtual switch";
111 longDescription = ''
112 Open vSwitch is a production quality, multilayer virtual switch
113 licensed under the open source Apache 2.0 license. It is
114 designed to enable massive network automation through
115 programmatic extension, while still supporting standard
116 management interfaces and protocols (e.g. NetFlow, sFlow, SPAN,
117 RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to
118 support distribution across multiple physical servers similar
119 to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V.
120 '';
121 homepage = "https://www.openvswitch.org/";
122 license = licenses.asl20;
123 maintainers = with maintainers; [ netixx kmcopper ];
124 platforms = platforms.linux;
125 };
126}