nixpkgs/pkgs/tools/security/vault/vault-bin.nix

64 lines
2 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, unzip, makeWrapper, gawk, glibc }:
let
version = "1.9.0";
sources = let
base = "https://releases.hashicorp.com/vault/${version}";
in {
2019-08-13 23:52:01 +02:00
x86_64-linux = fetchurl {
url = "${base}/vault_${version}_linux_amd64.zip";
sha256 = "sha256-atiwnKcNXCgiyHG3vSDs3vto6dpMS5qmBiAAqb/xn3o=";
};
2019-08-13 23:52:01 +02:00
i686-linux = fetchurl {
url = "${base}/vault_${version}_linux_386.zip";
sha256 = "sha256-ZqsWWyaZ7b7RjR999mvHe+f68w3+x5xwPB+EXseYaKk=";
};
2019-08-13 23:52:01 +02:00
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=";
};
2019-08-13 23:52:01 +02:00
aarch64-linux = fetchurl {
url = "${base}/vault_${version}_linux_arm64.zip";
sha256 = "sha256-Yy7mdXXdEBl1u/KB95/bWaDdej9SSIOMQsk3KCEeR5s=";
};
};
in stdenv.mkDerivation {
2019-08-13 23:52:01 +02:00
pname = "vault-bin";
inherit version;
2019-08-13 23:52:01 +02:00
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 \
2021-07-28 23:12:59 +02:00
--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 ];
};
}