diff --git a/pkgs/by-name/ov/ovn/generic.nix b/pkgs/by-name/ov/ovn/generic.nix new file mode 100644 index 000000000000..0dfe1f80d653 --- /dev/null +++ b/pkgs/by-name/ov/ovn/generic.nix @@ -0,0 +1,96 @@ +{ + version, + hash, + updateScriptArgs ? "", +}: + +{ + lib, + stdenv, + fetchFromGitHub, + autoreconfHook, + gnused, + libbpf, + libcap_ng, + numactl, + openssl, + pkg-config, + procps, + python3, + unbound, + xdp-tools, + writeScript, +}: + +stdenv.mkDerivation rec { + pname = "ovn"; + inherit version; + + src = fetchFromGitHub { + owner = "ovn-org"; + repo = "ovn"; + rev = "refs/tags/v${version}"; + inherit hash; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ + autoreconfHook + pkg-config + python3 + ]; + + buildInputs = [ + libbpf + libcap_ng + numactl + openssl + unbound + xdp-tools + ]; + + # need to build the ovs submodule first + preConfigure = '' + pushd ovs + ./boot.sh + ./configure + make -j $NIX_BUILD_CORES + popd + ''; + + enableParallelBuilding = true; + + doCheck = true; + + nativeCheckInputs = [ + gnused + procps + ]; + + # https://docs.ovn.org/en/latest/topics/testing.html + preCheck = '' + export TESTSUITEFLAGS="-j$NIX_BUILD_CORES" + # allow rechecks to retry flaky tests + export RECHECK=yes + + # hack to stop tests from trying to read /etc/resolv.conf + export OVS_RESOLV_CONF="$PWD/resolv.conf" + touch $OVS_RESOLV_CONF + ''; + + passthru.updateScript = writeScript "ovs-update.nu" '' + ${./update.nu} ${updateScriptArgs} + ''; + + meta = with lib; { + description = "Open Virtual Network"; + longDescription = '' + OVN (Open Virtual Network) is a series of daemons that translates virtual network configuration into OpenFlow, and installs them into Open vSwitch. + ''; + homepage = "https://github.com/ovn-org/ovn"; + changelog = "https://github.com/ovn-org/ovn/blob/${src.rev}/NEWS"; + license = licenses.asl20; + maintainers = with maintainers; [ adamcstephens ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/by-name/ov/ovn/lts.nix b/pkgs/by-name/ov/ovn/lts.nix new file mode 100644 index 000000000000..5a022fcd9f2d --- /dev/null +++ b/pkgs/by-name/ov/ovn/lts.nix @@ -0,0 +1,5 @@ +import ./generic.nix { + version = "22.03.5"; + hash = "sha256-DMDWR7Dbgak0azPcVqDdFHGovTbLX8byp+jQ3rYvvX4="; + updateScriptArgs = "--lts=true --regex '22.03.*'"; +} diff --git a/pkgs/by-name/ov/ovn/package.nix b/pkgs/by-name/ov/ovn/package.nix new file mode 100644 index 000000000000..50050d49a088 --- /dev/null +++ b/pkgs/by-name/ov/ovn/package.nix @@ -0,0 +1,4 @@ +import ./generic.nix { + version = "23.09.1"; + hash = "sha256-t4DtV0wW/jQX7/TpsLFoDzzSPROrhUHHG09r9+lsdaQ="; +} diff --git a/pkgs/by-name/ov/ovn/update.nu b/pkgs/by-name/ov/ovn/update.nu new file mode 100755 index 000000000000..ba55fce087ea --- /dev/null +++ b/pkgs/by-name/ov/ovn/update.nu @@ -0,0 +1,19 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i nu -p nushell common-updater-scripts + +def main [--lts: bool = false, --regex: string] { + let tags = list-git-tags --url=https://github.com/ovn-org/ovn | lines | sort --natural | str replace v '' + + let latest_tag = if $regex == null { $tags } else { $tags | find --regex $regex } | last + let current_version = nix eval --raw -f default.nix $"ovn(if $lts {"-lts"}).version" | str trim + + if $latest_tag != $current_version { + if $lts { + update-source-version ovn-lts $latest_tag $"--file=(pwd)/pkgs/by-name/ov/ovn/lts.nix" + } else { + update-source-version ovn $latest_tag $"--file=(pwd)/pkgs/by-name/ov/ovn/package.nix" + } + } + + {"lts?": $lts, before: $current_version, after: $latest_tag} +} diff --git a/pkgs/os-specific/linux/openvswitch/generic.nix b/pkgs/os-specific/linux/openvswitch/generic.nix index 83749782d274..ce800a7ba992 100644 --- a/pkgs/os-specific/linux/openvswitch/generic.nix +++ b/pkgs/os-specific/linux/openvswitch/generic.nix @@ -96,6 +96,9 @@ in stdenv.mkDerivation rec { doCheck = true; preCheck = '' + export TESTSUITEFLAGS="-j$NIX_BUILD_CORES" + export RECHECK=yes + patchShebangs tests/ ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 72c160ff13a0..26df720d7df6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11748,6 +11748,8 @@ with pkgs; openvswitch-lts = callPackage ../os-specific/linux/openvswitch/lts.nix { }; + ovn-lts = callPackage ../by-name/ov/ovn/lts.nix { }; + optifinePackages = callPackage ../tools/games/minecraft/optifine { }; optifine = optifinePackages.optifine-latest;