From f403684eee39400d78158e713b56360eb4f0d884 Mon Sep 17 00:00:00 2001 From: PsyanticY Date: Wed, 24 Jul 2019 11:02:10 +0100 Subject: [PATCH 1/2] vault-bin: init at 1.1.3 This binray contain the UI part of HashiCorp Vault that we were not able to build it due to the need to generate a very big yarn file. #49082 --- pkgs/tools/security/vault/vault-bin.nix | 57 +++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 59 insertions(+) create mode 100644 pkgs/tools/security/vault/vault-bin.nix diff --git a/pkgs/tools/security/vault/vault-bin.nix b/pkgs/tools/security/vault/vault-bin.nix new file mode 100644 index 00000000000..7befface3b5 --- /dev/null +++ b/pkgs/tools/security/vault/vault-bin.nix @@ -0,0 +1,57 @@ +{ 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"; + sha256 = "293b88f4d31f6bcdcc8b508eccb7b856a0423270adebfa0f52f04144c5a22ae0"; + }; + "i686-linux" = fetchurl { + url = "${base}/vault_${version}_linux_386.zip"; + sha256 = "9f2fb99e08fa3d25af1497516d08b5d2d8a73bcacd5354ddec024e9628795867"; + }; + "x86_64-darwin" = fetchurl { + url = "${base}/vault_${version}_darwin_amd64.zip"; + sha256 = "a0a7a242f8299ac4a00af8aa10ccedaf63013c8a068f56eadfb9d730b87155ea"; + }; + "i686-darwin" = fetchurl { + url = "${base}/vault_${version}_darwin_386.zip"; + sha256 = "50542cfb37abb06e8bb6b8ba41f5ca7d72a4d6a4396d4e3f4a8391bed14f63be"; + }; + "aarch64-linux" = fetchurl { + url = "${base}/vault_${version}_linux_arm64.zip"; + sha256 = "c243dce14b2e48e3667c2aa5b7fb37009dd7043b56032d6ebe50dd456715fd3f"; + }; + }; + +in + stdenv.mkDerivation { + + src = sources."${stdenv.hostPlatform.system}" or (throw "unsupported system: ${stdenv.hostPlatform.system}"); + + name = "vault-bin-${version}"; + + nativeBuildInputs = [ unzip ]; + + unpackPhase = "unzip $src -d 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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 79388cefe84..dedb6f870d2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24077,6 +24077,8 @@ in vault = callPackage ../tools/security/vault { }; + vault-bin = callPackage ../tools/security/vault/vault-bin.nix { }; + vaultenv = haskellPackages.vaultenv; vazir-fonts = callPackage ../data/fonts/vazir-fonts { }; From 558cdf0e11247f69585234e057deb22166e63793 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Sun, 4 Aug 2019 12:20:16 +0200 Subject: [PATCH 2/2] 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 7befface3b5..b58e41d850d 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 ]; + }; +}