mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
formatting/retab
This commit is contained in:
parent
8ef11bb0ee
commit
76a4de68c1
@ -5,116 +5,113 @@
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.virtualisation.vswitch;
|
||||
cfg = config.virtualisation.vswitch;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
# ------------------------------------------------------------
|
||||
|
||||
options = {
|
||||
options = {
|
||||
|
||||
virtualisation.vswitch.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description =
|
||||
''
|
||||
Enable Open vSwitch. A configuration
|
||||
daemon (ovs-server) will be started.
|
||||
'';
|
||||
};
|
||||
virtualisation.vswitch.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description =
|
||||
''
|
||||
Enable Open vSwitch. A configuration
|
||||
daemon (ovs-server) will be started.
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
virtualisation.vswitch.package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.openvswitch;
|
||||
description =
|
||||
''
|
||||
Open vSwitch package to use.
|
||||
'';
|
||||
};
|
||||
virtualisation.vswitch.package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.openvswitch;
|
||||
description =
|
||||
''
|
||||
Open vSwitch package to use.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (let
|
||||
|
||||
# Where the communication sockets live
|
||||
runDir = "/var/run/openvswitch";
|
||||
|
||||
# Where the config database live (can't be in nix-store)
|
||||
stateDir = "/var/db/openvswitch";
|
||||
|
||||
# The path to the an initialized version of the database
|
||||
db = pkgs.stdenv.mkDerivation {
|
||||
name = "vswitch.db";
|
||||
unpackPhase = "true";
|
||||
buildPhase = "true";
|
||||
buildInputs = with pkgs; [
|
||||
cfg.package
|
||||
];
|
||||
installPhase =
|
||||
''
|
||||
ensureDir $out/
|
||||
'';
|
||||
};
|
||||
|
||||
in {
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
boot.kernelModules = [ "tun" "openvswitch" ];
|
||||
|
||||
boot.extraModulePackages = [ cfg.package ];
|
||||
|
||||
systemd.services.ovsdb = {
|
||||
description = "Open_vSwitch Database Server";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "systemd-udev-settle.service" ];
|
||||
wants = [ "vswitchd.service" ];
|
||||
path = [ cfg.package ];
|
||||
restartTriggers = [ db cfg.package ];
|
||||
# Create the config database
|
||||
preStart =
|
||||
''
|
||||
mkdir -p ${runDir}
|
||||
mkdir -p /var/db/openvswitch
|
||||
chmod +w /var/db/openvswitch
|
||||
if [[ ! -e /var/db/openvswitch/conf.db ]]; then
|
||||
${cfg.package}/bin/ovsdb-tool create \
|
||||
"/var/db/openvswitch/conf.db" \
|
||||
"${cfg.package}/share/openvswitch/vswitch.ovsschema"
|
||||
fi
|
||||
chmod -R +w /var/db/openvswitch
|
||||
'';
|
||||
serviceConfig.ExecStart =
|
||||
''
|
||||
${cfg.package}/bin/ovsdb-server \
|
||||
--remote=punix:${runDir}/db.sock \
|
||||
--private-key=db:Open_vSwitch,SSL,private_key \
|
||||
--certificate=db:Open_vSwitch,SSL,certificate \
|
||||
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \
|
||||
--unixctl=ovsdb.ctl.sock \
|
||||
/var/db/openvswitch/conf.db
|
||||
'';
|
||||
serviceConfig.Restart = "always";
|
||||
serviceConfig.RestartSec = 3;
|
||||
postStart =
|
||||
''
|
||||
${cfg.package}/bin/ovs-vsctl --timeout 3 --retry --no-wait init
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
# ------------------------------------------------------------
|
||||
systemd.services.vswitchd = {
|
||||
description = "Open_vSwitch Daemon";
|
||||
bindsTo = [ "ovsdb.service" ];
|
||||
after = [ "ovsdb.service" ];
|
||||
path = [ cfg.package ];
|
||||
serviceConfig.ExecStart = ''${cfg.package}/bin/ovs-vswitchd'';
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (let
|
||||
|
||||
# Where the communication sockets live
|
||||
runDir = "/var/run/openvswitch";
|
||||
|
||||
# Where the config database live (can't be in nix-store)
|
||||
stateDir = "/var/db/openvswitch";
|
||||
|
||||
# The path to the an initialized version of the database
|
||||
db = pkgs.stdenv.mkDerivation {
|
||||
name = "vswitch.db";
|
||||
unpackPhase = "true";
|
||||
buildPhase = "true";
|
||||
buildInputs = with pkgs; [
|
||||
cfg.package
|
||||
];
|
||||
installPhase =
|
||||
''
|
||||
ensureDir $out/
|
||||
'';
|
||||
};
|
||||
|
||||
in {
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
boot.kernelModules = [ "tun" "openvswitch" ];
|
||||
|
||||
boot.extraModulePackages = [ cfg.package ];
|
||||
|
||||
systemd.services.ovsdb = {
|
||||
description = "Open_vSwitch Database Server";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "systemd-udev-settle.service" ];
|
||||
wants = [ "vswitchd.service" ];
|
||||
path = [ cfg.package ];
|
||||
restartTriggers = [ db cfg.package ];
|
||||
# Create the config database
|
||||
preStart =
|
||||
''
|
||||
mkdir -p ${runDir}
|
||||
mkdir -p /var/db/openvswitch
|
||||
chmod +w /var/db/openvswitch
|
||||
if [[ ! -e /var/db/openvswitch/conf.db ]]; then
|
||||
${cfg.package}/bin/ovsdb-tool create \
|
||||
"/var/db/openvswitch/conf.db" \
|
||||
"${cfg.package}/share/openvswitch/vswitch.ovsschema"
|
||||
fi
|
||||
chmod -R +w /var/db/openvswitch
|
||||
'';
|
||||
serviceConfig.ExecStart =
|
||||
''
|
||||
${cfg.package}/bin/ovsdb-server \
|
||||
--remote=punix:${runDir}/db.sock \
|
||||
--private-key=db:Open_vSwitch,SSL,private_key \
|
||||
--certificate=db:Open_vSwitch,SSL,certificate \
|
||||
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \
|
||||
--unixctl=ovsdb.ctl.sock \
|
||||
/var/db/openvswitch/conf.db
|
||||
'';
|
||||
serviceConfig.Restart = "always";
|
||||
serviceConfig.RestartSec = 3;
|
||||
postStart =
|
||||
''
|
||||
${cfg.package}/bin/ovs-vsctl --timeout 3 --retry --no-wait init
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
systemd.services.vswitchd = {
|
||||
description = "Open_vSwitch Daemon";
|
||||
bindsTo = [ "ovsdb.service" ];
|
||||
after = [ "ovsdb.service" ];
|
||||
path = [ cfg.package ];
|
||||
serviceConfig.ExecStart = ''${cfg.package}/bin/ovs-vswitchd'';
|
||||
};
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -1,49 +1,50 @@
|
||||
{ stdenv, fetchurl, openssl, python27, iproute, perl510, kernel ? null}:
|
||||
let
|
||||
|
||||
version = "2.1.2";
|
||||
version = "2.1.2";
|
||||
|
||||
skipKernelMod = kernel == null;
|
||||
skipKernelMod = kernel == null;
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
version = "2.1.2";
|
||||
name = "openvswitch-${version}";
|
||||
src = fetchurl {
|
||||
url = "http://openvswitch.org/releases/openvswitch-2.1.2.tar.gz";
|
||||
sha256 = "16q7faqrj2pfchhn0x5s9ggi5ckcg9n62f6bnqaih064aaq2jm47";
|
||||
};
|
||||
kernel = if skipKernelMod then null else kernel.dev;
|
||||
buildInputs = [
|
||||
openssl
|
||||
python27
|
||||
perl510
|
||||
];
|
||||
configureFlags = [
|
||||
"--localstatedir=/var"
|
||||
"--sharedstatedir=/var"
|
||||
"--sbindir=$(out)/bin"
|
||||
] ++ (if skipKernelMod then [] else ["--with-linux"]);
|
||||
# Leave /var out of this!
|
||||
installFlags = [
|
||||
"LOGDIR=$(TMPDIR)/dummy"
|
||||
"RUNDIR=$(TMPDIR)/dummy"
|
||||
"PKIDIR=$(TMPDIR)/dummy"
|
||||
];
|
||||
meta = {
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
description = "A multilayer virtual switch";
|
||||
longDescription = ''
|
||||
Open vSwitch is a production quality, multilayer virtual switch
|
||||
licensed under the open source Apache 2.0 license. It is
|
||||
designed to enable massive network automation through
|
||||
programmatic extension, while still supporting standard
|
||||
management interfaces and protocols (e.g. NetFlow, sFlow, SPAN,
|
||||
RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to
|
||||
support distribution across multiple physical servers similar
|
||||
to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V.
|
||||
'';
|
||||
homepage = "http://openvswitch.org/";
|
||||
licence = "Apache 2.0";
|
||||
};
|
||||
version = "2.1.2";
|
||||
name = "openvswitch-${version}";
|
||||
src = fetchurl {
|
||||
url = "http://openvswitch.org/releases/openvswitch-2.1.2.tar.gz";
|
||||
sha256 = "16q7faqrj2pfchhn0x5s9ggi5ckcg9n62f6bnqaih064aaq2jm47";
|
||||
};
|
||||
kernel = if skipKernelMod then null else kernel.dev;
|
||||
buildInputs = [
|
||||
openssl
|
||||
python27
|
||||
perl510
|
||||
];
|
||||
configureFlags = [
|
||||
"--localstatedir=/var"
|
||||
"--sharedstatedir=/var"
|
||||
"--sbindir=$(out)/bin"
|
||||
] ++ (if skipKernelMod then [] else ["--with-linux"]);
|
||||
# Leave /var out of this!
|
||||
installFlags = [
|
||||
"LOGDIR=$(TMPDIR)/dummy"
|
||||
"RUNDIR=$(TMPDIR)/dummy"
|
||||
"PKIDIR=$(TMPDIR)/dummy"
|
||||
];
|
||||
meta = {
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
description = "A multilayer virtual switch";
|
||||
longDescription =
|
||||
''
|
||||
Open vSwitch is a production quality, multilayer virtual switch
|
||||
licensed under the open source Apache 2.0 license. It is
|
||||
designed to enable massive network automation through
|
||||
programmatic extension, while still supporting standard
|
||||
management interfaces and protocols (e.g. NetFlow, sFlow, SPAN,
|
||||
RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to
|
||||
support distribution across multiple physical servers similar
|
||||
to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V.
|
||||
'';
|
||||
homepage = "http://openvswitch.org/";
|
||||
licence = "Apache 2.0";
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user