nixpkgs-suyu/pkgs/tools/security/vault/default.nix
Julian Vassev 15383e8403 vault: 0.11.2 -> 0.11.5
Update bash completion method as described in
https://www.vaultproject.io/docs/commands/#autocompletion
2018-12-02 15:37:56 -08:00

43 lines
1.2 KiB
Nix

{ stdenv, fetchFromGitHub, go, gox, removeReferencesTo }:
stdenv.mkDerivation rec {
name = "vault-${version}";
version = "0.11.5";
src = fetchFromGitHub {
owner = "hashicorp";
repo = "vault";
rev = "v${version}";
sha256 = "1skf9l3a4gwag9gp2vwmniajk8rb05g93s15q5xfwqb6sg6zplfw";
};
nativeBuildInputs = [ go gox removeReferencesTo ];
preBuild = ''
patchShebangs ./
substituteInPlace scripts/build.sh --replace 'git rev-parse HEAD' 'echo ${src.rev}'
sed -i s/'^GIT_DIRTY=.*'/'GIT_DIRTY="+NixOS"'/ scripts/build.sh
mkdir -p .git/hooks src/github.com/hashicorp
ln -s $(pwd) src/github.com/hashicorp/vault
export GOPATH=$(pwd)
'';
installPhase = ''
mkdir -p $out/bin $out/share/bash-completion/completions
cp pkg/*/* $out/bin/
find $out/bin -type f -exec remove-references-to -t ${go} '{}' +
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";
platforms = platforms.linux ++ platforms.darwin;
license = licenses.mpl20;
maintainers = with maintainers; [ rushmorem lnl7 offline pradeepchhetri ];
};
}