about summary refs log tree commit diff
path: root/pkgs/applications/networking/cluster/rke2/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/networking/cluster/rke2/default.nix')
-rw-r--r--pkgs/applications/networking/cluster/rke2/default.nix58
1 files changed, 18 insertions, 40 deletions
diff --git a/pkgs/applications/networking/cluster/rke2/default.nix b/pkgs/applications/networking/cluster/rke2/default.nix
index 99b0998582f4e..fc65ac8694731 100644
--- a/pkgs/applications/networking/cluster/rke2/default.nix
+++ b/pkgs/applications/networking/cluster/rke2/default.nix
@@ -1,41 +1,19 @@
-{ lib, stdenv, buildGoModule, fetchFromGitHub }:
-
-buildGoModule rec {
-  pname = "rke2";
-  version = "1.29.0+rke2r1";
-
-  src = fetchFromGitHub {
-    owner = "rancher";
-    repo = pname;
-    rev = "v${version}";
-    hash = "sha256-E59GUcbnbvsGZYn87RGNrGTVUsydKsjL+C5h15q74p0=";
-  };
-
-  vendorHash = "sha256-Og0CqxNnhRN6PdggneGK05uprZ2D7lux/snXcArIm8Q=";
-
-  postPatch = ''
-    # Patch the build scripts so they work in the Nix build environment.
-    patchShebangs ./scripts
-
-    # Disable the static build as it breaks.
-    sed -e 's/STATIC_FLAGS=.*/STATIC_FLAGS=/g' -i scripts/build-binary
-  '';
-
-  buildPhase = ''
-    DRONE_TAG="v${version}" ./scripts/build-binary
-  '';
-
-  installPhase = ''
-    install -D ./bin/rke2 $out/bin/rke2
-  '';
-
-  meta = with lib; {
-    homepage = "https://github.com/rancher/rke2";
-    description = "RKE2, also known as RKE Government, is Rancher's next-generation Kubernetes distribution.";
-    changelog = "https://github.com/rancher/rke2/releases/tag/v${version}";
-    license = licenses.asl20;
-    maintainers = with maintainers; [ zimbatm zygot ];
-    mainProgram = "rke2";
-    broken = stdenv.isDarwin;
-  };
+{ lib, callPackage, ... }@args:
+
+let
+  common = opts: callPackage (import ./builder.nix lib opts);
+  extraArgs = builtins.removeAttrs args [ "callPackage" ];
+in
+{
+  rke2_stable = common ((import ./stable/versions.nix) // {
+    updateScript = [ ./update-script.sh "stable" ];
+  }) extraArgs;
+
+  rke2_latest = common ((import ./latest/versions.nix) // {
+    updateScript = [ ./update-script.sh "latest" ];
+  }) extraArgs;
+
+  rke2_testing = common ((import ./testing/versions.nix) // {
+    updateScript = [ ./update-script.sh "testing" ];
+  }) extraArgs;
 }