commit aefdf0ddc5418d79132b74d3853b540889417c93
parent d67400ea74461336ed64f640998f25bdf0d96127
Author: Vincent Demeester <vincent@sbr.pm>
Date: Wed, 6 May 2020 09:41:04 +0200
operator-sdk: add 0.17 and multiple versions
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
2 files changed, 58 insertions(+), 35 deletions(-)
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -52,7 +52,11 @@ rec {
crc = crc_1_10;
# Operator SDK
- operator-sdk = pkgs.callPackage ./operator-sdk {};
+ inherit (pkgs.callPackage ./operator-sdk {})
+ operator-sdk_0_16
+ operator-sdk_0_17
+ ;
+ operator-sdk = operator-sdk_0_17;
# Tekton
inherit (pkgs.callPackage ./tkn {})
diff --git a/pkgs/operator-sdk/default.nix b/pkgs/operator-sdk/default.nix
@@ -1,40 +1,59 @@
{ stdenv, lib, buildGoModule, git, fetchFromGitHub }:
-buildGoModule rec {
- pname = "operator-sdk";
- version = "0.16.0";
- name = "${pname}-${version}";
- rev = "v${version}";
-
- builtInputs = [ "git" ];
-
- goPackagePath = "github.com/operator-framework/operator-sdk";
- subPackages = [ "cmd/operator-sdk" ];
- buildFlagsArray = let t = "${goPackagePath}/version"; in ''
- -ldflags=
- -X ${t}.GitVersion=${version}
- -X ${t}.KubernetesVersion=v1.17.2
- '';
-
- src = fetchFromGitHub {
- inherit rev;
- owner = "operator-framework";
- repo = "operator-sdk";
+with lib;
+rec {
+ operatorSdkGen =
+ { version
+ , sha256
+ , modSha256
+ }:
+
+ buildGoModule rec {
+ inherit modSha256;
+ pname = "operator-sdk";
+ name = "${pname}-${version}";
+ rev = "v${version}";
+
+ builtInputs = [ "git" ];
+
+ goPackagePath = "github.com/operator-framework/operator-sdk";
+ subPackages = [ "cmd/operator-sdk" ];
+ buildFlagsArray = let t = "${goPackagePath}/version"; in ''
+ -ldflags=
+ -X ${t}.GitVersion=${version}
+ -X ${t}.KubernetesVersion=v1.17.2
+ '';
+
+ src = fetchFromGitHub {
+ inherit rev;
+ owner = "operator-framework";
+ repo = "operator-sdk";
+ sha256 = "${sha256}";
+ };
+
+ postInstall = ''
+ # completions
+ mkdir -p $out/share/bash-completion/completions/
+ $out/bin/operator-sdk completion bash > $out/share/bash-completion/completions/operator-sdk
+ mkdir -p $out/share/zsh/site-functions/
+ $out/bin/operator-sdk completion zsh > $out/share/zsh/site-functions/_operator-sdk
+ '';
+
+ meta = {
+ description = "SDK for building Kubernetes applications. Provides high level APIs, useful abstractions, and project scaffolding";
+ homepage = https://github.com/operator-framework/operator-sdk;
+ license = lib.licenses.asl20;
+ };
+ };
+
+ operator-sdk_0_16 = makeOverridable operatorSdkGen {
+ version = "0.16.0";
sha256 = "1qdvnfxz81ij1y7qdk5xjq0nd3dqgbdjq0gmramxmkkz892cdaf3";
+ modSha256 = "11nz0fdxpsc9ifszprgp1l70myhadh90hcs94cilrpqwlci0i8c5";
};
- modSha256 = "11nz0fdxpsc9ifszprgp1l70myhadh90hcs94cilrpqwlci0i8c5";
-
- postInstall = ''
- # completions
- mkdir -p $out/share/bash-completion/completions/
- $out/bin/operator-sdk completion bash > $out/share/bash-completion/completions/operator-sdk
- mkdir -p $out/share/zsh/site-functions/
- $out/bin/operator-sdk completion zsh > $out/share/zsh/site-functions/_operator-sdk
- '';
-
- meta = {
- description = "SDK for building Kubernetes applications. Provides high level APIs, useful abstractions, and project scaffolding";
- homepage = https://github.com/operator-framework/operator-sdk;
- license = lib.licenses.asl20;
+ operator-sdk_0_17 = makeOverridable operatorSdkGen {
+ version = "0.17.0";
+ sha256 = "11mirwgmmhfccv1knxvf2pv51pisngw5lb8vpcbzi5v2lm192aqk";
+ modSha256 = "0mspbnw41c6r3p7kaafza1v10zi4jv0vrnzxwpyh7pkmx150xgvd";
};
}