This is an automated email from the ASF dual-hosted git repository.

franztt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-operator.git

commit 6f602d730906521f6a268437d207fbffbadb11e4
Author: francescotimperi <[email protected]>
AuthorDate: Sat Jul 13 15:21:18 2024 +0000

    feat: adds mc and wsk CLI via nix
---
 shell.nix | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/shell.nix b/shell.nix
index 3d4487b..eb1d670 100644
--- a/shell.nix
+++ b/shell.nix
@@ -19,6 +19,61 @@
 let
   nixpkgs = fetchTarball 
"https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";;
   pkgs = import nixpkgs { config = {}; overlays = []; };
+
+  # 
+  # Align the version of minio-client to the same used by openserverless 
operator if changed
+  # and update also the sha256 value accordingly.
+  #
+  minio-client = pkgs.stdenv.mkDerivation rec {
+    pname = "minio-client";
+    version = "RELEASE.2023-03-23T20-03-04Z";
+    src = pkgs.fetchurl {
+      url = 
"https://dl.min.io/client/mc/release/linux-amd64/archive/mc.${version}";;
+      sha256 = 
"5de4aec1fc6c6608723a1d6da988350c876d5eb14538000ccb4d3a226199ab89";
+    };
+    phases = [ "unpackPhase" "installPhase" ];
+    unpackPhase = ''
+      runHook preUnpack
+      mkdir -p $out
+      cp $src $out/mc.${version}
+      runHook postUnpack
+    '';
+    installPhase = ''
+      mkdir -p $out/bin
+      install -m755 $out/mc.${version} $out/bin/mc
+    '';    
+  };
+
+  #
+  # Openwhisk wsk CLI it is still required
+  #
+  wsk = pkgs.stdenv.mkDerivation rec {
+    pname = "wsk";
+    version = "1.2.0";
+
+    src = pkgs.fetchurl {
+      url = 
"https://github.com/apache/openwhisk-cli/releases/download/${version}/OpenWhisk_CLI-${version}-linux-amd64.tgz";;
+      sha256 = 
"c404ac124b7f98c49d293c9abae28740283ce2615248690e7652a94648780820";
+    };
+
+    phases = [ "unpackPhase" "installPhase" ];
+
+    unpackPhase = ''
+      runHook preUnpack
+      
+      mkdir -p $out/tmp      
+      cat $src| tar xzvf - -C $out/tmp
+
+      runHook postUnpack
+    '';
+
+    installPhase = ''
+      mkdir -p $out/bin
+      install -m755 $out/tmp/wsk $out/bin/wsk
+    ''; 
+
+  };
+
 in
 
 pkgs.mkShellNoCC {
@@ -28,7 +83,8 @@ pkgs.mkShellNoCC {
    poetry
    zip
    unzip
-   # minio-client-2023-03-23T20-03-04Z
+   minio-client
+   wsk
   ];
 
 }

Reply via email to