depot/third_party/nixpkgs/pkgs/tools/security/vault/vault-bin.nix
Default email ce641f4048 Project import generated by Copybara.
GitOrigin-RevId: bc5d68306b40b8522ffb69ba6cff91898c2fbbff
2021-12-06 17:07:01 +01:00

63 lines
2 KiB
Nix

{ lib, stdenv, fetchurl, unzip, makeWrapper, gawk, glibc }:
let
version = "1.9.0";
sources = let
base = "https://releases.hashicorp.com/vault/${version}";
in {
x86_64-linux = fetchurl {
url = "${base}/vault_${version}_linux_amd64.zip";
sha256 = "sha256-atiwnKcNXCgiyHG3vSDs3vto6dpMS5qmBiAAqb/xn3o=";
};
i686-linux = fetchurl {
url = "${base}/vault_${version}_linux_386.zip";
sha256 = "sha256-ZqsWWyaZ7b7RjR999mvHe+f68w3+x5xwPB+EXseYaKk=";
};
x86_64-darwin = fetchurl {
url = "${base}/vault_${version}_darwin_amd64.zip";
sha256 = "sha256-PXK72di2SNAgyAqu1SimZNN3YLqWwMw9E2cagpN3b4Y=";
};
aarch64-darwin = fetchurl {
url = "${base}/vault_${version}_darwin_arm64.zip";
sha256 = "sha256-7OxGz3jqzvfC/y2vkTdhQ+IjmMSQ4XmSHecbJ/oM2EI=";
};
aarch64-linux = fetchurl {
url = "${base}/vault_${version}_linux_arm64.zip";
sha256 = "sha256-Yy7mdXXdEBl1u/KB95/bWaDdej9SSIOMQsk3KCEeR5s=";
};
};
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
'';
dontStrip = stdenv.isDarwin;
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-darwin" "aarch64-linux" ];
license = licenses.mpl20;
maintainers = with maintainers; teams.serokell.members ++ [ offline psyanticy Chili-Man ];
};
}