From 32c6918ba519cfb7ee717481dd2d2997aaca8453 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Thu, 21 Dec 2023 11:08:12 -0500 Subject: [PATCH] ovn/ovn-lts: init at 23.09.1/22.03.5 --- pkgs/by-name/ov/ovn/generic.nix | 96 +++++++++++++++++++++++++++++++++ pkgs/by-name/ov/ovn/lts.nix | 5 ++ pkgs/by-name/ov/ovn/package.nix | 4 ++ pkgs/by-name/ov/ovn/update.nu | 19 +++++++ pkgs/top-level/all-packages.nix | 2 + 5 files changed, 126 insertions(+) create mode 100644 pkgs/by-name/ov/ovn/generic.nix create mode 100644 pkgs/by-name/ov/ovn/lts.nix create mode 100644 pkgs/by-name/ov/ovn/package.nix create mode 100755 pkgs/by-name/ov/ovn/update.nu 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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ae21ad1aeafb..5d1b23fe7d7b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11750,6 +11750,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;