78 lines
1.7 KiB
Nix

{
lib,
stdenv,
autoPatchelfHook,
fetchurl,
makeWrapper,
nixosTests,
versionCheckHook,
}:
let
version = "1.35.0";
inherit (stdenv.hostPlatform) system;
throwSystem = throw "envoy-bin is not available for ${system}.";
plat =
{
aarch64-linux = "aarch_64";
x86_64-linux = "x86_64";
}
.${system} or throwSystem;
hash =
{
aarch64-linux = "sha256-PLlFrs65Z+mV5V2OoW+bb/91DC5V9Ss2HnERccIunWY=";
x86_64-linux = "sha256-0l12MVwCNrUPjn9t6hOpuUscP6EQQHNLd0kG4YjhEeY=";
}
.${system} or throwSystem;
in
stdenv.mkDerivation {
pname = "envoy-bin";
inherit version;
src = fetchurl {
url = "https://github.com/envoyproxy/envoy/releases/download/v${version}/envoy-${version}-linux-${plat}";
inherit hash;
};
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ makeWrapper ];
dontUnpack = true;
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -m755 $src $out/bin/envoy
runHook postInstall
'';
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
versionCheckProgram = "${placeholder "out"}/bin/envoy";
versionCheckProgramArg = "--version";
passthru = {
tests.envoy-bin = nixosTests.envoy-bin;
updateScript = ./update.sh;
};
meta = {
homepage = "https://envoyproxy.io";
changelog = "https://github.com/envoyproxy/envoy/releases/tag/v${version}";
description = "Cloud-native edge and service proxy";
license = lib.licenses.asl20;
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
maintainers = with lib.maintainers; [
adamcstephens
];
mainProgram = "envoy";
platforms = [
"x86_64-linux"
"aarch64-linux"
];
};
}