diff --git a/pkgs/by-name/ar/argocd/package.nix b/pkgs/by-name/ar/argocd/package.nix index b6ec6f336c7e..597778941003 100644 --- a/pkgs/by-name/ar/argocd/package.nix +++ b/pkgs/by-name/ar/argocd/package.nix @@ -5,29 +5,55 @@ installShellFiles, nix-update-script, stdenv, + fetchYarnDeps, + yarnConfigHook, + yarnBuildHook, + nodejs, }: buildGoModule rec { pname = "argocd"; - version = "2.14.11"; + version = "3.1.0"; src = fetchFromGitHub { owner = "argoproj"; repo = "argo-cd"; rev = "v${version}"; - hash = "sha256-KCU/WMytx4kOzlkZDwLfRRfutBtdk6UVBNdXOWC5kWc="; + hash = "sha256-zg6zd10hpGUOukrwMK0qJXBL8nVgPSZJ6+jh+/mbOL0="; + }; + + ui = stdenv.mkDerivation { + pname = "${pname}-ui"; + inherit version; + src = src + "/ui"; + + offlineCache = fetchYarnDeps { + yarnLock = "${src}/ui/yarn.lock"; + hash = "sha256-ekhSPWzIgFhwSw0bIlBqu8LTYk3vuJ9VM8eHc3mnHGM="; + }; + + nativeBuildInputs = [ + yarnConfigHook + yarnBuildHook + nodejs + ]; + + postInstall = '' + mkdir -p $out + cp -r dist $out/dist + ''; }; proxyVendor = true; # darwin/linux hash mismatch - vendorHash = "sha256-Xm9J08pxzm3fPQjMA6NDu+DPJGsvtUvj+n/qrOZ9BE4="; + vendorHash = "sha256-tYHA1WlziKWOvv3uF3tTSrvqDoHBVRhUnKZXOxT1rMk="; # Set target as ./cmd per cli-local - # https://github.com/argoproj/argo-cd/blob/master/Makefile#L227 + # https://github.com/argoproj/argo-cd/blob/master/Makefile subPackages = [ "cmd" ]; ldflags = let - packageUrl = "github.com/argoproj/argo-cd/v2/common"; + packageUrl = "github.com/argoproj/argo-cd/v3/common"; in [ "-s" @@ -41,12 +67,17 @@ buildGoModule rec { nativeBuildInputs = [ installShellFiles ]; + preBuild = '' + cp -r ${ui}/dist ./ui + stat ./ui/dist/app/index.html # Sanity check + ''; + # set ldflag for kubectlVersion since it is needed for argo # Per https://github.com/search?q=repo%3Aargoproj%2Fargo-cd+%22KUBECTL_VERSION%3D%22+path%3AMakefile&type=code prePatch = '' export KUBECTL_VERSION=$(grep 'k8s.io/kubectl v' go.mod | cut -f 2 -d " " | cut -f 1 -d "=" ) echo using $KUBECTL_VERSION - ldflags="''${ldflags} -X github.com/argoproj/argo-cd/v2/common.kubectlVersion=''${KUBECTL_VERSION}" + ldflags="''${ldflags} -X github.com/argoproj/argo-cd/v3/common.kubectlVersion=''${KUBECTL_VERSION}" ''; installPhase = '' runHook preInstall