at master 177 lines 4.0 kB view raw
1{ 2 withDPDK ? false, 3 4 lib, 5 stdenv, 6 7 autoconf, 8 automake, 9 dpdk, 10 fetchFromGitHub, 11 installShellFiles, 12 iproute2, 13 libcap_ng, 14 libpcap, 15 libtool, 16 makeWrapper, 17 nix-update-script, 18 nixosTests, 19 numactl, 20 openssl, 21 perl, 22 pkg-config, 23 procps, 24 python3, 25 sphinxHook, 26 tcpdump, 27 util-linux, 28 which, 29}: 30 31stdenv.mkDerivation rec { 32 pname = if withDPDK then "openvswitch-dpdk" else "openvswitch"; 33 version = "3.6.0"; 34 35 src = fetchFromGitHub { 36 owner = "openvswitch"; 37 repo = "ovs"; 38 tag = "v${version}"; 39 hash = "sha256-zzEE1H0fjFOZY3KXFPb91Bmk3irPL1mHEbEBsumPlkw="; 40 }; 41 42 outputs = [ 43 "out" 44 "dev" 45 "lib" 46 "man" 47 "tools" 48 ]; 49 50 patches = [ 51 # 8: vsctl-bashcomp - argument completion FAILED (completion.at:664) 52 ./patches/disable-bash-arg-completion-test.patch 53 ]; 54 55 nativeBuildInputs = [ 56 autoconf 57 automake 58 installShellFiles 59 libtool 60 pkg-config 61 sphinxHook 62 makeWrapper 63 ]; 64 65 sphinxBuilders = [ "man" ]; 66 67 sphinxRoot = "./Documentation"; 68 69 buildInputs = [ 70 libcap_ng 71 openssl 72 perl 73 procps 74 python3 75 util-linux 76 which 77 ] 78 ++ (lib.optionals withDPDK [ 79 dpdk 80 numactl 81 libpcap 82 ]); 83 84 preConfigure = "./boot.sh"; 85 86 configureFlags = [ 87 "--localstatedir=/var" 88 "--sharedstatedir=/var" 89 "--sbindir=$(out)/bin" 90 ] 91 ++ (lib.optionals withDPDK [ "--with-dpdk=shared" ]); 92 93 # Leave /var out of this! 94 installFlags = [ 95 "LOGDIR=$(TMPDIR)/dummy" 96 "RUNDIR=$(TMPDIR)/dummy" 97 "PKIDIR=$(TMPDIR)/dummy" 98 ]; 99 100 enableParallelBuilding = true; 101 102 postInstall = '' 103 # Install bash completions in correct location 104 rm -f $out/etc/bash_completion.d/ovs-*.bash 105 installShellCompletion utilities/ovs-appctl-bashcomp.bash 106 installShellCompletion utilities/ovs-vsctl-bashcomp.bash 107 108 mkdir -p $tools/{bin,share/openvswitch/scripts} 109 mv $out/share/openvswitch/bugtool-plugins $tools/share/openvswitch 110 mv $out/share/openvswitch/scripts/ovs-{bugtool*,check-dead-ifs,monitor-ipsec,vtep} $tools/share/openvswitch/scripts 111 mv $out/share/openvswitch/scripts/usdt $tools/share/openvswitch/scripts 112 mv $out/bin/ovs-{bugtool,dpctl-top,l3ping,parse-backtrace,pcap,tcpdump,tcpundump,test,vlan-test} $tools/bin 113 114 wrapProgram $tools/bin/ovs-l3ping \ 115 --prefix PYTHONPATH : $out/share/openvswitch/python 116 117 wrapProgram $tools/bin/ovs-tcpdump \ 118 --prefix PATH : ${lib.makeBinPath [ tcpdump ]} \ 119 --prefix PYTHONPATH : $out/share/openvswitch/python 120 ''; 121 122 doCheck = true; 123 preCheck = '' 124 export TESTSUITEFLAGS="-j$NIX_BUILD_CORES" 125 export RECHECK=yes 126 127 patchShebangs tests/ 128 ''; 129 130 nativeCheckInputs = [ 131 iproute2 132 ] 133 ++ (with python3.pkgs; [ 134 netaddr 135 pyparsing 136 pytest 137 setuptools 138 ]); 139 140 passthru = { 141 tests = { 142 default = nixosTests.openvswitch; 143 incus = nixosTests.incus-lts.openvswitch; 144 }; 145 146 updateScript = nix-update-script { }; 147 }; 148 149 meta = { 150 changelog = "https://www.openvswitch.org/releases/NEWS-${version}.txt"; 151 description = "Multilayer virtual switch"; 152 longDescription = '' 153 Open vSwitch is a production quality, multilayer virtual switch 154 licensed under the open source Apache 2.0 license. It is 155 designed to enable massive network automation through 156 programmatic extension, while still supporting standard 157 management interfaces and protocols (e.g. NetFlow, sFlow, SPAN, 158 RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to 159 support distribution across multiple physical servers similar 160 to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V. 161 ''; 162 homepage = "https://www.openvswitch.org/"; 163 license = with lib.licenses; [ 164 asl20 165 lgpl21Plus # ovs-bugtool 166 sissl11 # lib/sflow 167 ]; 168 maintainers = with lib.maintainers; [ 169 adamcstephens 170 booxter 171 kmcopper 172 netixx 173 xddxdd 174 ]; 175 platforms = lib.platforms.linux; 176 }; 177}