Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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.5.1"; 34 35 src = fetchFromGitHub { 36 owner = "openvswitch"; 37 repo = "ovs"; 38 tag = "v${version}"; 39 hash = "sha256-iiFpX4w6vdsRxjhRcxXTTtSAb8WPwg1afqwgBpzjhoA="; 40 }; 41 42 outputs = [ 43 "out" 44 "man" 45 ]; 46 47 patches = [ 48 # 8: vsctl-bashcomp - argument completion FAILED (completion.at:664) 49 ./patches/disable-bash-arg-completion-test.patch 50 ]; 51 52 nativeBuildInputs = [ 53 autoconf 54 automake 55 installShellFiles 56 libtool 57 pkg-config 58 sphinxHook 59 makeWrapper 60 ]; 61 62 sphinxBuilders = [ "man" ]; 63 64 sphinxRoot = "./Documentation"; 65 66 buildInputs = [ 67 libcap_ng 68 openssl 69 perl 70 procps 71 python3 72 util-linux 73 which 74 ] 75 ++ (lib.optionals withDPDK [ 76 dpdk 77 numactl 78 libpcap 79 ]); 80 81 preConfigure = "./boot.sh"; 82 83 configureFlags = [ 84 "--localstatedir=/var" 85 "--sharedstatedir=/var" 86 "--sbindir=$(out)/bin" 87 ] 88 ++ (lib.optionals withDPDK [ "--with-dpdk=shared" ]); 89 90 # Leave /var out of this! 91 installFlags = [ 92 "LOGDIR=$(TMPDIR)/dummy" 93 "RUNDIR=$(TMPDIR)/dummy" 94 "PKIDIR=$(TMPDIR)/dummy" 95 ]; 96 97 enableParallelBuilding = true; 98 99 postInstall = '' 100 installShellCompletion --bash utilities/ovs-appctl-bashcomp.bash 101 installShellCompletion --bash utilities/ovs-vsctl-bashcomp.bash 102 103 wrapProgram $out/bin/ovs-l3ping \ 104 --prefix PYTHONPATH : $out/share/openvswitch/python 105 106 wrapProgram $out/bin/ovs-tcpdump \ 107 --prefix PATH : ${lib.makeBinPath [ tcpdump ]} \ 108 --prefix PYTHONPATH : $out/share/openvswitch/python 109 ''; 110 111 doCheck = true; 112 preCheck = '' 113 export TESTSUITEFLAGS="-j$NIX_BUILD_CORES" 114 export RECHECK=yes 115 116 patchShebangs tests/ 117 ''; 118 119 nativeCheckInputs = [ 120 iproute2 121 ] 122 ++ (with python3.pkgs; [ 123 netaddr 124 pyparsing 125 pytest 126 setuptools 127 ]); 128 129 passthru = { 130 tests = { 131 default = nixosTests.openvswitch; 132 incus = nixosTests.incus-lts.openvswitch; 133 }; 134 135 updateScript = nix-update-script { }; 136 }; 137 138 meta = { 139 changelog = "https://www.openvswitch.org/releases/NEWS-${version}.txt"; 140 description = "Multilayer virtual switch"; 141 longDescription = '' 142 Open vSwitch is a production quality, multilayer virtual switch 143 licensed under the open source Apache 2.0 license. It is 144 designed to enable massive network automation through 145 programmatic extension, while still supporting standard 146 management interfaces and protocols (e.g. NetFlow, sFlow, SPAN, 147 RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to 148 support distribution across multiple physical servers similar 149 to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V. 150 ''; 151 homepage = "https://www.openvswitch.org/"; 152 license = lib.licenses.asl20; 153 maintainers = with lib.maintainers; [ 154 adamcstephens 155 kmcopper 156 netixx 157 xddxdd 158 ]; 159 platforms = lib.platforms.linux; 160 }; 161}