{ config, pkgs, ... }: let buildBinPackage = options: pkgs.stdenv.mkDerivation { inherit (options) pname version; src = pkgs.fetchurl { inherit (options) url sha256; }; unpackPhase = if options ? "binPath" then "unpackFile $src" else ":"; installPhase = let binPath = if options ? "binPath" then options.binPath else "$src"; completionCommands = if options ? hasCompletion then '' $out/bin/${options.pname} completion bash > $out/share/bash-completion/completions/${options.pname} $out/bin/${options.pname} completion zsh > $out/share/zsh/site-functions/_${options.pname} '' else ""; in '' mkdir -p $out/bin $out/share/bash-completion/completions $out/share/zsh/site-functions cp ${binPath} $out/bin/${options.pname} chmod +x $out/bin/${options.pname} ${completionCommands} ''; }; argocd = buildBinPackage rec { pname = "argocd"; version = "1.3.0"; url = "https://github.com/argoproj/argo-cd/releases/download/v${version}/argocd-linux-amd64"; sha256 = "1mspgjipalngbjl9rdi2pyvq3g8nh4w2sq5isz87l7fkj4cy4qvk"; hasCompletion = true; }; helm = buildBinPackage rec { pname = "helm"; version = "3.0.0"; url = "https://get.helm.sh/helm-v${version}-linux-amd64.tar.gz"; sha256 = "10e1fdcca263062b1d7b2cb93a924be1ef3dd6c381263d8151dd1a20a3d8c0dc"; binPath = "linux-amd64/helm"; hasCompletion = true; }; eksctl = buildBinPackage rec { pname = "eksctl"; version = "0.10.2"; url = "https://github.com/weaveworks/eksctl/releases/download/${version}/eksctl_Linux_amd64.tar.gz"; sha256 = "d3e70cd101ca4756ca9b2fbbeb6edcf580ae4783d80004c8847fa177e7d32e03"; binPath = "eksctl"; hasCompletion = true; }; k9s = buildBinPackage rec { pname = "k9s"; version = "0.9.3"; url = "https://github.com/derailed/k9s/releases/download/${version}/k9s_${version}_Linux_x86_64.tar.gz"; sha256 = "af3608517684e59de94573ad123486edd6f392c8c319ddbde6223d3ac2d37bd9"; binPath = "k9s"; }; kustomize = buildBinPackage rec { pname = "kustomize"; version = "3.2.1"; url = "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${version}/kustomize_kustomize.v${version}_linux_amd64"; sha256 = "a91b38778945e8a63fe70bc7522703a94c1d572d5dcee245e96647359e1fd04b"; }; in { environment.systemPackages = with pkgs; [ kubectl kubectx kops argocd helm eksctl k9s kustomize aws-iam-authenticator ]; }