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