depot/third_party/nixpkgs/pkgs/tools/networking/zrok/default.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

56 lines
1.5 KiB
Nix

{ lib
, stdenv
, fetchzip
}:
let
inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${system}";
plat = {
x86_64-linux = "linux_amd64";
aarch64-linux = "linux_arm64";
armv7l-linux = "linux_armv7";
}.${system} or throwSystem;
hash = {
x86_64-linux = "sha256-vAX7vx13eHyPuDe4q5b8dQD90l5bbnncMGlXnegumxM=";
aarch64-linux = "sha256-6x/E0uAPFOsuoJ/ePLV483M07Rqj5pkcpETOVq9RXKU=";
armv7l-linux = "sha256-UlpqoKfjyGLNKvSrXqqsiiq/wTlfmBmPfynDoFT/nuQ=";
}.${system} or throwSystem;
in
stdenv.mkDerivation (finalAttrs: {
pname = "zrok";
version = "0.4.18";
src = fetchzip {
url = "https://github.com/openziti/zrok/releases/download/v${finalAttrs.version}/zrok_${finalAttrs.version}_${plat}.tar.gz";
stripRoot = false;
inherit hash;
};
updateScript = ./update.sh;
installPhase = let
interpreter = "$(< \"$NIX_CC/nix-support/dynamic-linker\")";
in ''
runHook preInstall
mkdir -p $out/bin
cp zrok $out/bin/
chmod +x $out/bin/zrok
patchelf --set-interpreter "${interpreter}" "$out/bin/zrok"
runHook postInstall
'';
meta = {
description = "Geo-scale, next-generation sharing platform built on top of OpenZiti";
homepage = "https://zrok.io";
license = lib.licenses.asl20;
mainProgram = "zrok";
maintainers = [ lib.maintainers.bandresen ];
platforms = [ "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})