nixpkgs/pkgs/by-name/va/vault-bin/package.nix
2024-11-21 16:31:08 -05:00

83 lines
2.1 KiB
Nix

{
lib,
stdenv,
fetchzip,
}:
stdenv.mkDerivation rec {
pname = "vault-bin";
version = "1.18.2";
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";
};
hash = selectSystem {
x86_64-linux = "sha256-l1S/E6NYP6fjPcD7CdNlMKQfbrSCtxIsDjiykmu2+Pc=";
aarch64-linux = "sha256-WgsKyrw9AALWVzHTjrleuEk/0BVYk3yF+H4oadU5g7g=";
i686-linux = "sha256-t0O/i/YxT0jTOJRX4YhCHkeSb8iNzD5EgKLAupVyCg4=";
x86_64-darwin = "sha256-1TMZXvx/RmzKJWuLUddKRI9rufqQC9HWVRSclAJZuSI=";
aarch64-darwin = "sha256-Tl+b88RY/Vj3/2KlZmE/uLd7KmGSVMwW0ttmTEvFM2g=";
};
in
fetchzip {
url = "https://releases.hashicorp.com/vault/${version}/vault_${version}_${suffix}.zip";
stripRoot = false;
inherit hash;
};
dontConfigure = true;
dontBuild = true;
dontStrip = stdenv.hostPlatform.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 = "Tool for managing secrets, this binary includes the UI";
homepage = "https://www.vaultproject.io";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.bsl11;
maintainers =
with maintainers;
teams.serokell.members
++ [
offline
psyanticy
Chili-Man
techknowlogick
];
mainProgram = "vault";
platforms = [
"x86_64-linux"
"i686-linux"
"x86_64-darwin"
"aarch64-darwin"
"aarch64-linux"
];
};
}