about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/cluster/k3s
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-04-09 18:28:16 +0000
committerAlyssa Ross <hi@alyssa.is>2021-04-12 18:46:15 +0000
commitfd2e737e0678ee7d8081baef05b305146a2c0034 (patch)
treeac3e9b27576a0382335532d126f9a66d486bc638 /nixpkgs/pkgs/applications/networking/cluster/k3s
parentcc207d720b6aa836e256c1ee9842bc739e630a8a (diff)
parent9e377a6ce42dccd9b624ae4ce8f978dc892ba0e2 (diff)
downloadnixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.gz
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.bz2
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.lz
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.xz
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.zst
nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.zip
Merge remote-tracking branch 'nixpkgs/nixos-unstable'
Diffstat (limited to 'nixpkgs/pkgs/applications/networking/cluster/k3s')
-rw-r--r--nixpkgs/pkgs/applications/networking/cluster/k3s/default.nix27
-rw-r--r--nixpkgs/pkgs/applications/networking/cluster/k3s/patches/0001-Use-rm-from-path-in-go-generate.patch25
2 files changed, 18 insertions, 34 deletions
diff --git a/nixpkgs/pkgs/applications/networking/cluster/k3s/default.nix b/nixpkgs/pkgs/applications/networking/cluster/k3s/default.nix
index 739992e6bc0b..285e1db536de 100644
--- a/nixpkgs/pkgs/applications/networking/cluster/k3s/default.nix
+++ b/nixpkgs/pkgs/applications/networking/cluster/k3s/default.nix
@@ -3,7 +3,7 @@
 , makeWrapper
 , socat
 , iptables
-, iproute
+, iproute2
 , bridge-utils
 , conntrack-tools
 , buildGoPackage
@@ -19,6 +19,7 @@
 , fetchurl
 , fetchzip
 , fetchgit
+, zstd
 }:
 
 with lib;
@@ -43,9 +44,9 @@ with lib;
 # Those pieces of software we entirely ignore upstream's handling of, and just
 # make sure they're in the path if desired.
 let
-  k3sVersion = "1.19.4+k3s2";     # k3s git tag
+  k3sVersion = "1.20.4+k3s1";     # k3s git tag
   traefikChartVersion = "1.81.0"; # taken from ./scripts/download at the above k3s tag
-  k3sRootVersion = "0.7.1";       # taken from ./scripts/download at the above k3s tag
+  k3sRootVersion = "0.8.1";       # taken from ./scripts/download at the above k3s tag
   k3sCNIVersion = "0.8.6-k3s1";   # taken from ./scripts/version.sh at the above k3s tag
   # bundled into the k3s binary
   traefikChart = fetchurl {
@@ -64,7 +65,7 @@ let
   k3sRoot = fetchzip {
     # Note: marked as apache 2.0 license
     url = "https://github.com/k3s-io/k3s-root/releases/download/v${k3sRootVersion}/k3s-root-amd64.tar";
-    sha256 = "1wjg54816plbdwgv0dibq6dzmcakcmx0wiqijvr4f3gsxgk59zwf";
+    sha256 = "sha256-r3Nkzl9ccry7cgD3YWlHvEWOsWnnFGIkyRH9sx12gks=";
     stripRoot = false;
   };
   k3sPlugins = buildGoPackage rec {
@@ -95,7 +96,7 @@ let
     url = "https://github.com/k3s-io/k3s";
     rev = "v${k3sVersion}";
     leaveDotGit = true; # ./scripts/version.sh depends on git
-    sha256 = "1qxjdgnq8mf54760f0vngcqa2y3b048pcmfsf1g593b2ij1kg1zi";
+    sha256 = "0rmn3nh8a94axv6lb2xjnn3gpq0scnvj69bvcs74azvw62fvq016";
   };
   # Stage 1 of the k3s build:
   # Let's talk about how k3s is structured.
@@ -126,7 +127,12 @@ let
 
     src = k3sRepo;
 
-    patches = [ ./patches/0001-Use-rm-from-path-in-go-generate.patch ./patches/0002-Add-nixpkgs-patches.patch ];
+    # Patch build scripts so that we can use them.
+    # This makes things more dynamically linked (because nix can deal with
+    # dynamically linked dependencies just fine), removes the upload at the
+    # end, and skips building runc + cni, since we have our own derivations for
+    # those.
+    patches = [ ./patches/0002-Add-nixpkgs-patches.patch ];
 
     nativeBuildInputs = [ git pkg-config ];
     buildInputs = [ libseccomp ];
@@ -166,9 +172,10 @@ let
 
     src = k3sRepo;
 
-    patches = [ ./patches/0001-Use-rm-from-path-in-go-generate.patch ./patches/0002-Add-nixpkgs-patches.patch ];
+    # See the above comment in k3sBuildStage1
+    patches = [ ./patches/0002-Add-nixpkgs-patches.patch ];
 
-    nativeBuildInputs = [ git pkg-config ];
+    nativeBuildInputs = [ git pkg-config zstd ];
     # These dependencies are embedded as compressed files in k3s at runtime.
     # Propagate them to avoid broken runtime references to libraries.
     propagatedBuildInputs = [ k3sPlugins k3sBuildStage1 runc ];
@@ -233,7 +240,7 @@ stdenv.mkDerivation rec {
     kmod
     socat
     iptables
-    iproute
+    iproute2
     bridge-utils
     ethtool
     util-linux
@@ -255,10 +262,12 @@ stdenv.mkDerivation rec {
   # Use a wrapper script to reference all the binaries that k3s tries to
   # execute, but that we didn't bundle with it.
   installPhase = ''
+    runHook preInstall
     mkdir -p "$out/bin"
     makeWrapper ${k3sBin}/bin/k3s "$out/bin/k3s" \
       --prefix PATH : ${lib.makeBinPath k3sRuntimeDeps} \
       --prefix PATH : "$out/bin"
+    runHook postInstall
   '';
 
   meta = {
diff --git a/nixpkgs/pkgs/applications/networking/cluster/k3s/patches/0001-Use-rm-from-path-in-go-generate.patch b/nixpkgs/pkgs/applications/networking/cluster/k3s/patches/0001-Use-rm-from-path-in-go-generate.patch
deleted file mode 100644
index c439241e8558..000000000000
--- a/nixpkgs/pkgs/applications/networking/cluster/k3s/patches/0001-Use-rm-from-path-in-go-generate.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From e79ddef65d08599ae3fe8ff39d202ea2416650b8 Mon Sep 17 00:00:00 2001
-From: Euan Kemp <euank@euank.com>
-Date: Sun, 31 May 2020 17:27:05 -0700
-Subject: [PATCH 1/2] Use 'rm' from path in go generate
-
-/bin/rm is less portable. On some distros, like nixos, it doesn't exist
-at all.
----
- main.go | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/main.go b/main.go
-index 62908bb7bb..0527222887 100644
---- a/main.go
-+++ b/main.go
-@@ -1,5 +1,5 @@
- //go:generate go run pkg/codegen/cleanup/main.go
--//go:generate /bin/rm -rf pkg/generated
-+//go:generate rm -rf pkg/generated
- //go:generate go run pkg/codegen/main.go
- //go:generate go fmt pkg/deploy/zz_generated_bindata.go
- //go:generate go fmt pkg/static/zz_generated_bindata.go
--- 
-2.25.4
-