summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorEric Bailey <eric@ericb.me>2021-02-21 22:47:14 -0600
committerEric Bailey <yurrriq@users.noreply.github.com>2021-03-03 13:50:19 -0600
commit93ea4e0102bd979c05f038d885179e1a34c0194f (patch)
tree1a64b70d735360dd57e1786bcd860886a9175c73 /pkgs/applications
parent7667cf9112070d3dd8791d5e4c82a07c48bd2623 (diff)
downloadnixpkgs-93ea4e0102bd979c05f038d885179e1a34c0194f.tar
nixpkgs-93ea4e0102bd979c05f038d885179e1a34c0194f.tar.gz
nixpkgs-93ea4e0102bd979c05f038d885179e1a34c0194f.tar.bz2
nixpkgs-93ea4e0102bd979c05f038d885179e1a34c0194f.tar.lz
nixpkgs-93ea4e0102bd979c05f038d885179e1a34c0194f.tar.xz
nixpkgs-93ea4e0102bd979c05f038d885179e1a34c0194f.tar.zst
nixpkgs-93ea4e0102bd979c05f038d885179e1a34c0194f.zip
kubernetes-helmPlugins: build rather than download
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/networking/cluster/helm/plugins/default.nix35
-rw-r--r--pkgs/applications/networking/cluster/helm/plugins/helm-diff.nix35
-rw-r--r--pkgs/applications/networking/cluster/helm/plugins/helm-s3.nix38
-rw-r--r--pkgs/applications/networking/cluster/helm/plugins/helm-secrets.nix44
4 files changed, 122 insertions, 30 deletions
diff --git a/pkgs/applications/networking/cluster/helm/plugins/default.nix b/pkgs/applications/networking/cluster/helm/plugins/default.nix
index 5c1a5a57d76..edd19a25f9b 100644
--- a/pkgs/applications/networking/cluster/helm/plugins/default.nix
+++ b/pkgs/applications/networking/cluster/helm/plugins/default.nix
@@ -1,36 +1,11 @@
-{ stdenv, fetchFromGitHub, fetchurl, fetchzip }:
-let
+{ callPackage }:
 
-  buildHelmPlugin = { name, ... }@attrs:
-    fetchzip (attrs // {
-      stripRoot = false;
-    });
-in {
+{
 
-  helm-s3 = let
-    pname = "helm-s3";
-    version = "0.10.0";
-  in buildHelmPlugin rec {
-    name = "${pname}-${version}";
-    url = "https://github.com/hypnoglow/helm-s3/releases/download/v${version}/helm-s3_${version}_linux_amd64.tar.gz";
-    sha256 = "sha256-pTux7HArWB5yO1Oehfd+ZpeGUziI2+wfUart5WfkQW4=";
+  helm-diff = callPackage ./helm-diff.nix {};
 
-    extraPostFetch = ''
-      mkdir $out/${pname}
-      GLOBIGNORE="$out/${pname}"
-      mv $out/* -t $out/${pname}
-    '';
-  };
+  helm-s3 = callPackage ./helm-s3.nix {};
 
-  helm-diff = buildHelmPlugin {
-    name = "helm-diff";
-    url = "https://github.com/databus23/helm-diff/releases/download/v3.1.3/helm-diff-linux.tgz";
-    sha256 = "sha256-oGmBPcCyUgq2YD4+CkGrbf6/JhzXJjmkaiqX/3a03aE=";
-  };
+  helm-secrets = callPackage ./helm-secrets.nix {};
 
-  helm-secrets = buildHelmPlugin {
-    name = "helm-secrets";
-    url = "https://github.com/jkroepke/helm-secrets/releases/download/v3.4.1/helm-secrets.tar.gz";
-    sha256 = "sha256-HXwbs/bXJXF75FbLB/En0jirCQnz8HpU3o9LeMyV0e8=";
-  };
 }
diff --git a/pkgs/applications/networking/cluster/helm/plugins/helm-diff.nix b/pkgs/applications/networking/cluster/helm/plugins/helm-diff.nix
new file mode 100644
index 00000000000..ce6491bfba4
--- /dev/null
+++ b/pkgs/applications/networking/cluster/helm/plugins/helm-diff.nix
@@ -0,0 +1,35 @@
+{ buildGoModule, fetchFromGitHub, lib }:
+
+buildGoModule rec {
+  pname = "helm-diff";
+  version = "3.1.3";
+
+  src = fetchFromGitHub {
+    owner = "databus23";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-h26EOjKNrlcrs2DAYj0NmDRgNRKozjfw5DtxUgHNTa4=";
+  };
+
+  vendorSha256 = "sha256-+n/QBuZqtdgUkaBG7iqSuBfljn+AdEzDoIo5SI8ErQA=";
+
+  # NOTE: Remove the install and upgrade hooks.
+  postPatch = ''
+    sed -i '/^hooks:/,+2 d' plugin.yaml
+  '';
+
+  postInstall = ''
+    install -dm755 $out/${pname}
+    mv $out/bin $out/${pname}/
+    mv $out/${pname}/bin/{helm-,}diff
+    install -m644 -Dt $out/${pname} plugin.yaml
+  '';
+
+  meta = with lib; {
+    description = "A Helm plugin that shows a diff";
+    inherit (src.meta) homepage;
+    license = licenses.apsl20;
+    maintainers = with maintainers; [ yurrriq ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/applications/networking/cluster/helm/plugins/helm-s3.nix b/pkgs/applications/networking/cluster/helm/plugins/helm-s3.nix
new file mode 100644
index 00000000000..661048a0c72
--- /dev/null
+++ b/pkgs/applications/networking/cluster/helm/plugins/helm-s3.nix
@@ -0,0 +1,38 @@
+{ buildGoModule, fetchFromGitHub, lib }:
+
+buildGoModule rec {
+  pname = "helm-s3";
+  version = "0.10.0";
+
+  src = fetchFromGitHub {
+    owner = "hypnoglow";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-2BQ/qtoL+iFbuLvrJGUuxWFKg9u1sVDRcRm2/S0mgyc=";
+  };
+
+  vendorSha256 = "sha256-/9TiY0XdkiNxW5JYeC5WD9hqySCyYYU8lB+Ft5Vm96I=";
+
+  # NOTE: Remove the install and upgrade hooks.
+  postPatch = ''
+    sed -i '/^hooks:/,+2 d' plugin.yaml
+  '';
+
+  checkPhase = ''
+    make test-unit
+  '';
+
+  postInstall = ''
+    install -dm755 $out/${pname}
+    mv $out/bin $out/${pname}/
+    install -m644 -Dt $out/${pname} plugin.yaml
+  '';
+
+  meta = with lib; {
+    description = "A Helm plugin that shows a diff";
+    inherit (src.meta) homepage;
+    license = licenses.apsl20;
+    maintainers = with maintainers; [ yurrriq ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/applications/networking/cluster/helm/plugins/helm-secrets.nix b/pkgs/applications/networking/cluster/helm/plugins/helm-secrets.nix
new file mode 100644
index 00000000000..d53abe3569c
--- /dev/null
+++ b/pkgs/applications/networking/cluster/helm/plugins/helm-secrets.nix
@@ -0,0 +1,44 @@
+{ lib, stdenv, fetchFromGitHub, makeWrapper, coreutils, findutils, getopt, gnugrep, gnused, sops, vault }:
+
+stdenv.mkDerivation rec {
+  pname = "helm-secrets";
+  version = "3.4.1";
+
+  src = fetchFromGitHub {
+    owner = "jkroepke";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-EXCr0QjupsBBKTm6Opw5bcNwAD4FGGyOiqaa8L91/OI=";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ getopt sops ];
+
+  # NOTE: helm-secrets is comprised of shell scripts.
+  dontBuild = true;
+
+  # NOTE: Remove the install and upgrade hooks.
+  postPatch = ''
+    sed -i '/^hooks:/,+2 d' plugin.yaml
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -dm755 $out/${pname} $out/${pname}/scripts
+    install -m644 -Dt $out/${pname} plugin.yaml
+    cp -r scripts/* $out/${pname}/scripts
+    wrapProgram $out/${pname}/scripts/run.sh \
+        --prefix PATH : ${lib.makeBinPath [ coreutils findutils getopt gnugrep gnused sops vault ]}
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "A Helm plugin that helps manage secrets";
+    inherit (src.meta) homepage;
+    license = licenses.apsl20;
+    maintainers = with maintainers; [ yurrriq ];
+    platforms = platforms.all;
+  };
+}