1{ stdenv, lib, fetchFromGitHub, buildGoModule, installShellFiles, nixosTests
2, makeWrapper
3, gawk
4, glibc
5}:
6
7buildGoModule rec {
8 pname = "vault";
9 version = "1.8.4";
10
11 src = fetchFromGitHub {
12 owner = "hashicorp";
13 repo = "vault";
14 rev = "v${version}";
15 sha256 = "sha256-t/BQu6nq0FcmqTc/vo3bTUbVNDqzePqlOMFkl4pD598=";
16 };
17
18 vendorSha256 = "sha256-9eXDcuVm+N4nenotUtCvyp2qB5uPDwzGHk43Y4uTT14=";
19
20 subPackages = [ "." ];
21
22 nativeBuildInputs = [ installShellFiles makeWrapper ];
23
24 tags = [ "vault" ];
25
26 ldflags = [
27 "-s" "-w"
28 "-X github.com/hashicorp/vault/sdk/version.GitCommit=${src.rev}"
29 "-X github.com/hashicorp/vault/sdk/version.Version=${version}"
30 "-X github.com/hashicorp/vault/sdk/version.VersionPrerelease="
31 ];
32
33 postInstall = ''
34 echo "complete -C $out/bin/vault vault" > vault.bash
35 installShellCompletion vault.bash
36 '' + lib.optionalString stdenv.isLinux ''
37 wrapProgram $out/bin/vault \
38 --prefix PATH ${lib.makeBinPath [ gawk glibc ]}
39 '';
40
41 passthru.tests.vault = nixosTests.vault;
42
43 meta = with lib; {
44 homepage = "https://www.vaultproject.io/";
45 description = "A tool for managing secrets";
46 changelog = "https://github.com/hashicorp/vault/blob/v${version}/CHANGELOG.md";
47 platforms = platforms.linux ++ platforms.darwin;
48 license = licenses.mpl20;
49 maintainers = with maintainers; [ rushmorem lnl7 offline pradeepchhetri Chili-Man ];
50 };
51}