summary refs log tree commit diff
diff options
context:
space:
mode:
authorZhaofeng Li <hello@zhaofeng.li>2023-06-23 15:23:50 -0600
committerZhaofeng Li <hello@zhaofeng.li>2023-06-23 15:23:50 -0600
commitfca3189a7a681108b67882972fb97fdf8a9c5123 (patch)
tree27673a7c088171aab8f62fa3f3ee21dac3d1ba1c
parente603dc5f061ca1d8a19b3ede6a8cf9c9fcba6cdc (diff)
downloadnixpkgs-fca3189a7a681108b67882972fb97fdf8a9c5123.tar
nixpkgs-fca3189a7a681108b67882972fb97fdf8a9c5123.tar.gz
nixpkgs-fca3189a7a681108b67882972fb97fdf8a9c5123.tar.bz2
nixpkgs-fca3189a7a681108b67882972fb97fdf8a9c5123.tar.lz
nixpkgs-fca3189a7a681108b67882972fb97fdf8a9c5123.tar.xz
nixpkgs-fca3189a7a681108b67882972fb97fdf8a9c5123.tar.zst
nixpkgs-fca3189a7a681108b67882972fb97fdf8a9c5123.zip
k3s: Fix override
-rw-r--r--pkgs/applications/networking/cluster/k3s/builder.nix49
-rw-r--r--pkgs/applications/networking/cluster/k3s/default.nix11
2 files changed, 31 insertions, 29 deletions
diff --git a/pkgs/applications/networking/cluster/k3s/builder.nix b/pkgs/applications/networking/cluster/k3s/builder.nix
index 0d3d127e484..88c11fac1c8 100644
--- a/pkgs/applications/networking/cluster/k3s/builder.nix
+++ b/pkgs/applications/networking/cluster/k3s/builder.nix
@@ -1,3 +1,28 @@
+lib:
+{
+  # git tag
+  k3sVersion,
+  # commit hash
+  k3sCommit,
+  k3sRepoSha256 ? lib.fakeHash,
+  k3sVendorSha256 ? lib.fakeHash,
+  # taken from ./scripts/version.sh VERSION_ROOT https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/version.sh#L47
+  k3sRootVersion,
+  k3sRootSha256 ? lib.fakeHash,
+  # Based on the traefik charts here: https://github.com/k3s-io/k3s/blob/d71ab6317e22dd34673faa307a412a37a16767f6/scripts/download#L29-L32
+  # see also https://github.com/k3s-io/k3s/blob/d71ab6317e22dd34673faa307a412a37a16767f6/manifests/traefik.yaml#L8
+  chartVersions,
+  # taken from ./scripts/version.sh VERSION_CNIPLUGINS https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/version.sh#L45
+  k3sCNIVersion,
+  k3sCNISha256 ? lib.fakeHash,
+  # taken from ./scripts/version.sh VERSION_CONTAINERD
+  containerdVersion,
+  containerdSha256 ? lib.fakeHash,
+  # run `grep github.com/kubernetes-sigs/cri-tools go.mod | head -n1 | awk '{print $4}'` in the k3s repo at the tag
+  criCtlVersion,
+  updateScript ? null,
+}:
+
 # builder.nix contains a "builder" expression that, given k3s version and hash
 # variables, creates a package for that version.
 # Due to variance in k3s's build process, this builder only works for k3s 1.26+
@@ -32,30 +57,6 @@
 , pkgsBuildBuild
 }:
 
-{
-  # git tag
-  k3sVersion,
-  # commit hash
-  k3sCommit,
-  k3sRepoSha256 ? lib.fakeHash,
-  k3sVendorSha256 ? lib.fakeHash,
-  # taken from ./scripts/version.sh VERSION_ROOT https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/version.sh#L47
-  k3sRootVersion,
-  k3sRootSha256 ? lib.fakeHash,
-  # Based on the traefik charts here: https://github.com/k3s-io/k3s/blob/d71ab6317e22dd34673faa307a412a37a16767f6/scripts/download#L29-L32
-  # see also https://github.com/k3s-io/k3s/blob/d71ab6317e22dd34673faa307a412a37a16767f6/manifests/traefik.yaml#L8
-  chartVersions,
-  # taken from ./scripts/version.sh VERSION_CNIPLUGINS https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/version.sh#L45
-  k3sCNIVersion,
-  k3sCNISha256 ? lib.fakeHash,
-  # taken from ./scripts/version.sh VERSION_CONTAINERD
-  containerdVersion,
-  containerdSha256 ? lib.fakeHash,
-  # run `grep github.com/kubernetes-sigs/cri-tools go.mod | head -n1 | awk '{print $4}'` in the k3s repo at the tag
-  criCtlVersion,
-  updateScript ? null,
-}:
-
 # k3s is a kinda weird derivation. One of the main points of k3s is the
 # simplicity of it being one binary that can perform several tasks.
 # However, when you have a good package manager (like nix), that doesn't
diff --git a/pkgs/applications/networking/cluster/k3s/default.nix b/pkgs/applications/networking/cluster/k3s/default.nix
index d8ecd79b5ca..aec9603bb23 100644
--- a/pkgs/applications/networking/cluster/k3s/default.nix
+++ b/pkgs/applications/networking/cluster/k3s/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, callPackage }:
 
 let
-  k3s_builder = import ./builder.nix;
+  k3s_builder = import ./builder.nix lib;
+  common = opts: callPackage (k3s_builder opts);
 in
 {
-  k3s_1_26 = (callPackage k3s_builder { }) {
+  k3s_1_26 = common {
     k3sVersion = "1.26.4+k3s1";
     k3sCommit = "8d0255af07e95b841952563253d27b0d10bd72f0";
     k3sRepoSha256 = "0qlszdnlsvj3hzx2p0wl3zhaw908w8a62z6vlf2g69a3c75f55cs";
@@ -17,10 +18,10 @@ in
     containerdVersion = "1.6.19-k3s1";
     containerdSha256 = "12dwqh77wplg30kdi73d90qni23agw2cwxjd2p5lchq86mpmmwwr";
     criCtlVersion = "1.26.0-rc.0-k3s1";
-  };
+  } { };
 
   # 1_27 can be built with the same builder as 1_26
-  k3s_1_27 = (callPackage k3s_builder { }) (import ./1_27/versions.nix) // {
+  k3s_1_27 = common ((import ./1_27/versions.nix) // {
     updateScript = ./1_27/update-script.sh;
-  };
+  }) { };
 }