depot/pkgs/tools/networking/zrok/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00: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-EzMkl/XTtieAj/pg1L4BLTEuWNnQ5m18WYu/sqRZx/I=";
aarch64-linux = "sha256-D5FpJBRzvbsgrQmopJQpJZTIm9TroaGB6fkYX2UAaHM=";
armv7l-linux = "sha256-PQl/ZQxxkzQ4iTUPBO9tbCsswOnEQuupdzxul0/vKG4=";
}.${system} or throwSystem;
in
stdenv.mkDerivation (finalAttrs: {
pname = "zrok";
version = "0.4.39";
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 ];
};
})