nixpkgs/pkgs/tools/security/vault/default.nix
2021-12-30 22:12:12 -08:00

52 lines
1.4 KiB
Nix

{ stdenv, lib, fetchFromGitHub, buildGoModule, installShellFiles, nixosTests
, makeWrapper
, gawk
, glibc
}:
buildGoModule rec {
pname = "vault";
version = "1.9.2";
src = fetchFromGitHub {
owner = "hashicorp";
repo = "vault";
rev = "v${version}";
sha256 = "sha256-vuwVPBB7zxpmJsBZ+J/vl0E49gx7CUGGi5j1Grgv2Jo=";
};
vendorSha256 = "sha256-OHGQ6v51jfxEhe7v8b9/yh7aPZmgTod+WFKFzwXk4LU=";
subPackages = [ "." ];
nativeBuildInputs = [ installShellFiles makeWrapper ];
tags = [ "vault" ];
ldflags = [
"-s" "-w"
"-X github.com/hashicorp/vault/sdk/version.GitCommit=${src.rev}"
"-X github.com/hashicorp/vault/sdk/version.Version=${version}"
"-X github.com/hashicorp/vault/sdk/version.VersionPrerelease="
];
postInstall = ''
echo "complete -C $out/bin/vault vault" > vault.bash
installShellCompletion vault.bash
'' + lib.optionalString stdenv.isLinux ''
wrapProgram $out/bin/vault \
--prefix PATH ${lib.makeBinPath [ gawk glibc ]}
'';
passthru.tests = { inherit (nixosTests) vault vault-postgresql; };
meta = with lib; {
homepage = "https://www.vaultproject.io/";
description = "A tool for managing secrets";
changelog = "https://github.com/hashicorp/vault/blob/v${version}/CHANGELOG.md";
platforms = platforms.linux ++ platforms.darwin;
license = licenses.mpl20;
maintainers = with maintainers; [ rushmorem lnl7 offline pradeepchhetri Chili-Man ];
};
}