nixpkgs-suyu/pkgs/tools/security/vault/vault-bin.nix
2020-08-24 04:20:00 -05:00

54 lines
1.7 KiB
Nix

{ stdenv, fetchurl, unzip }:
let
version = "1.5.2";
sources = let
base = "https://releases.hashicorp.com/vault/${version}";
in {
x86_64-linux = fetchurl {
url = "${base}/vault_${version}_linux_amd64.zip";
sha256 = "1m9svs1ncgdwwh16xavwikq4ji9rzkb2wlr59sx61rlz0l18mknd";
};
i686-linux = fetchurl {
url = "${base}/vault_${version}_linux_386.zip";
sha256 = "0hd6gsrmjfly3075kq0rsxhgy927g1462qih0iiwphrhik7l0pwr";
};
x86_64-darwin = fetchurl {
url = "${base}/vault_${version}_darwin_amd64.zip";
sha256 = "092xqjm69ljn70hn9f93qkc0ila0hgj2l14plhsza52d924qnq3l";
};
i686-darwin = fetchurl {
url = "${base}/vault_${version}_darwin_386.zip";
sha256 = "161j15n6kfd3m5hakc0qn824kp0nwdghcm81j9vqzpq900sbg6ak";
};
aarch64-linux = fetchurl {
url = "${base}/vault_${version}_linux_arm64.zip";
sha256 = "1f6ckfqqj9gsaizwxa7xrjgkkj3nd6m1md7smz0xnxgnc4f7g4z0";
};
};
in stdenv.mkDerivation {
pname = "vault-bin";
inherit version;
src = sources.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
nativeBuildInputs = [ unzip ];
sourceRoot = ".";
installPhase = ''
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
'';
meta = with stdenv.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" "i686-darwin" ];
license = licenses.mpl20;
maintainers = with maintainers; [ offline psyanticy mkaito ];
};
}