nixpkgs-suyu/pkgs/tools/security/vault/vault-bin.nix
2023-03-31 05:31:21 +00:00

63 lines
2 KiB
Nix

{ lib, stdenv, fetchurl, unzip, makeWrapper, gawk, glibc, fetchzip }:
stdenv.mkDerivation rec {
pname = "vault-bin";
version = "1.13.1";
src =
let
inherit (stdenv.hostPlatform) system;
selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}");
suffix = selectSystem {
x86_64-linux = "linux_amd64";
aarch64-linux = "linux_arm64";
i686-linux = "linux_386";
x86_64-darwin = "darwin_amd64";
aarch64-darwin = "darwin_arm64";
};
sha256 = selectSystem {
x86_64-linux = "sha256-BTJPXC5MEfNopJv1p0ONduVLrYza+0SfUcmN805JLPo=";
aarch64-linux = "sha256-p9TgSqPVgR7Qxu1WEuwawzbBDNznGfPGasZK8/jN7vk=";
i686-linux = "sha256-EbHH5Ud1c5YbcQ3qXhWEiaxx4XuslRntOLkxcf8elz8=";
x86_64-darwin = "sha256-JiwF8/ZBbFGqhcYP4z5aPya61+2J5HG9vEYKEDAIuC0=";
aarch64-darwin = "sha256-BgqqKqrqZiBSQwkMpWndiRhRq6+rR3e1IcPik5ZxCg4=";
};
in
fetchzip {
url = "https://releases.hashicorp.com/vault/${version}/vault_${version}_${suffix}.zip";
inherit sha256;
};
dontConfigure = true;
dontBuild = true;
dontStrip = stdenv.isDarwin;
installPhase = ''
runHook preInstall
install -D vault $out/bin/vault
runHook postInstall
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/vault --help
$out/bin/vault version
runHook postInstallCheck
'';
dontPatchELF = true;
dontPatchShebangs = true;
passthru.updateScript = ./update-bin.sh;
meta = with lib; {
description = "A tool for managing secrets, this binary includes the UI";
homepage = "https://www.vaultproject.io";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.mpl20;
maintainers = with maintainers; teams.serokell.members ++ [ offline psyanticy Chili-Man techknowlogick mkaito ];
mainProgram = "vault";
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
};
}