nixpkgs/pkgs/tools/security/vault/vault-bin.nix
2022-05-11 17:49:33 -04:00

63 lines
1.9 KiB
Nix

{ lib, stdenv, fetchurl, unzip, makeWrapper, gawk, glibc, fetchzip }:
stdenv.mkDerivation rec {
pname = "vault-bin";
version = "1.10.3";
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-hz7u6sW415h/AsGlyghImo3K54gbAS92N6L0dI8vV8Q=";
aarch64-linux = "sha256-DIrVgHeVvDNx0vRwXt2gzf3HDYzDeYQ2JVy+7KlrLUo=";
i686-linux = "sha256-B0xamHI6GnHrKLjhIBvs89keShJ45fRgyM7M214S9jY=";
x86_64-darwin = "sha256-ubPcl/e0nwYYw5SrN2jfrGSwLHbi99jklYMDZuVdf6s=";
aarch64-darwin = "sha256-4CKrelIzaXu2GccWo2ZTzGSqCMTM1qmJ0drGD8F3c0k=";
};
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";
license = licenses.mpl20;
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" ];
};
}