1{ stdenv, fetchurl, makeWrapper, pkgconfig, utillinux, which
2, procps, libcap_ng, openssl, python27, iproute , perl
3, kernel ? null }:
4
5with stdenv.lib;
6
7let
8 _kernel = kernel;
9in stdenv.mkDerivation rec {
10 version = "2.5.0";
11 name = "openvswitch-${version}";
12
13 src = fetchurl {
14 url = "http://openvswitch.org/releases/${name}.tar.gz";
15 sha256 = "08bgsqjjn2q5hvxsjqs7n3jir7k7291wlj3blsqhacjhmpxm9nil";
16 };
17
18 kernel = optional (_kernel != null) _kernel.dev;
19
20 buildInputs = [ makeWrapper pkgconfig utillinux openssl libcap_ng python27
21 perl procps which ];
22
23 configureFlags = [
24 "--localstatedir=/var"
25 "--sharedstatedir=/var"
26 "--sbindir=$(out)/bin"
27 ] ++ (optionals (_kernel != null) ["--with-linux"]);
28
29 # Leave /var out of this!
30 installFlags = [
31 "LOGDIR=$(TMPDIR)/dummy"
32 "RUNDIR=$(TMPDIR)/dummy"
33 "PKIDIR=$(TMPDIR)/dummy"
34 ];
35
36 postBuild = ''
37 # fix tests
38 substituteInPlace xenserver/opt_xensource_libexec_interface-reconfigure --replace '/usr/bin/env python' '${python27.interpreter}'
39 substituteInPlace vtep/ovs-vtep --replace '/usr/bin/env python' '${python27.interpreter}'
40 '';
41
42 enableParallelBuilding = true;
43 doCheck = false; # bash-completion test fails with "compgen: command not found"
44
45 postInstall = ''
46 cp debian/ovs-monitor-ipsec $out/share/openvswitch/scripts
47 makeWrapper \
48 $out/share/openvswitch/scripts/ovs-monitor-ipsec \
49 $out/bin/ovs-monitor-ipsec \
50 --prefix PYTHONPATH : "$out/share/openvswitch/python"
51 substituteInPlace $out/share/openvswitch/scripts/ovs-monitor-ipsec \
52 --replace "UnixctlServer.create(None)" "UnixctlServer.create(os.environ['UNIXCTLPATH'])"
53 substituteInPlace $out/share/openvswitch/scripts/ovs-monitor-ipsec \
54 --replace "self.psk_file" "root_prefix + self.psk_file"
55 substituteInPlace $out/share/openvswitch/scripts/ovs-monitor-ipsec \
56 --replace "self.cert_dir" "root_prefix + self.cert_dir"
57 '';
58
59 meta = with stdenv.lib; {
60 platforms = platforms.linux;
61 description = "A multilayer virtual switch";
62 longDescription =
63 ''
64 Open vSwitch is a production quality, multilayer virtual switch
65 licensed under the open source Apache 2.0 license. It is
66 designed to enable massive network automation through
67 programmatic extension, while still supporting standard
68 management interfaces and protocols (e.g. NetFlow, sFlow, SPAN,
69 RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to
70 support distribution across multiple physical servers similar
71 to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V.
72 '';
73 homepage = "http://openvswitch.org/";
74 license = licenses.asl20;
75 };
76}