From 558cdf0e11247f69585234e057deb22166e63793 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Sun, 4 Aug 2019 12:20:16 +0200 Subject: [PATCH] vault-bin: use sourceRoot instead of custom unpackPhase --- pkgs/tools/security/vault/vault-bin.nix | 42 +++++++++++-------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/pkgs/tools/security/vault/vault-bin.nix b/pkgs/tools/security/vault/vault-bin.nix index 7befface3b5d..b58e41d850d8 100644 --- a/pkgs/tools/security/vault/vault-bin.nix +++ b/pkgs/tools/security/vault/vault-bin.nix @@ -1,12 +1,10 @@ { stdenv, fetchurl, unzip }: let - version = "1.1.3"; + sources = let - base = "https://releases.hashicorp.com/vault/${version}"; - in { "x86_64-linux" = fetchurl { url = "${base}/vault_${version}_linux_amd64.zip"; @@ -30,28 +28,26 @@ let }; }; -in - stdenv.mkDerivation { +in stdenv.mkDerivation { + name = "vault-bin-${version}"; - src = sources."${stdenv.hostPlatform.system}" or (throw "unsupported system: ${stdenv.hostPlatform.system}"); + src = sources."${stdenv.hostPlatform.system}" or (throw "unsupported system: ${stdenv.hostPlatform.system}"); - name = "vault-bin-${version}"; + nativeBuildInputs = [ unzip ]; - nativeBuildInputs = [ unzip ]; + sourceRoot = "."; - unpackPhase = "unzip $src -d vault"; + 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 + ''; - installPhase = '' - mkdir -p $out/bin $out/share/bash-completion/completions - mv vault/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 ]; - }; - } \ No newline at end of file + 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 ]; + }; +}