{ lib, stdenv, fetchurl, unzip, makeWrapper, gawk, glibc }: let version = "1.8.3"; sources = let base = "https://releases.hashicorp.com/vault/${version}"; in { x86_64-linux = fetchurl { url = "${base}/vault_${version}_linux_amd64.zip"; sha256 = "sha256-x1ZHemRyblfMgmG2zx3AnZmhn2Q952v3nzi3HEvlmE8="; }; i686-linux = fetchurl { url = "${base}/vault_${version}_linux_386.zip"; sha256 = "1141zjf56fz76ka7bim9qkdk46pa3kk39swxza17g3qxpj21w0jp"; }; x86_64-darwin = fetchurl { url = "${base}/vault_${version}_darwin_amd64.zip"; sha256 = "06bkka2k09alhps5h2dk0dgczgnnd6g4npjp9j103lvzi935zjsy"; }; aarch64-linux = fetchurl { url = "${base}/vault_${version}_linux_arm64.zip"; sha256 = "1z9pv46pgqnn34mc624x9z41kvr4hrjjdp6y9zv033h0cpxbd0y7"; }; }; in stdenv.mkDerivation { pname = "vault-bin"; inherit version; src = sources.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); nativeBuildInputs = [ makeWrapper unzip ]; sourceRoot = "."; installPhase = '' runHook preInstall mkdir -p $out/bin $out/share/bash-completion/completions mv vault $out/bin echo "complete -C $out/bin/vault vault" > $out/share/bash-completion/completions/vault '' + lib.optionalString stdenv.isLinux '' wrapProgram $out/bin/vault \ --prefix PATH : ${lib.makeBinPath [ gawk glibc ]} runHook postInstall ''; meta = with lib; { homepage = "https://www.vaultproject.io"; description = "A tool for managing secrets, this binary includes the UI"; platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]; license = licenses.mpl20; maintainers = with maintainers; teams.serokell.members ++ [ offline psyanticy Chili-Man ]; }; }