Merge pull request #101739 from euank/k3s-seccomp-dep

k3s: propagate runtime dependencies of the k3s binary
This commit is contained in:
Florian Klink 2020-12-09 21:10:26 +01:00 committed by GitHub
commit c2756603f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -158,8 +158,8 @@ let
platforms = platforms.linux; platforms = platforms.linux;
}; };
}; };
k3sBuild = buildGoPackage rec { k3sBin = buildGoPackage rec {
name = "k3s-build"; name = "k3s-bin";
version = "${k3sVersion}"; version = "${k3sVersion}";
goPackagePath = "github.com/rancher/k3s"; goPackagePath = "github.com/rancher/k3s";
@ -169,7 +169,9 @@ let
patches = [ ./patches/0001-Use-rm-from-path-in-go-generate.patch ./patches/0002-Add-nixpkgs-patches.patch ]; patches = [ ./patches/0001-Use-rm-from-path-in-go-generate.patch ./patches/0002-Add-nixpkgs-patches.patch ];
nativeBuildInputs = [ git pkgconfig ]; nativeBuildInputs = [ git pkgconfig ];
buildInputs = [ k3sBuildStage1 k3sPlugins runc ]; # These dependencies are embedded as compressed files in k3s at runtime.
# Propagate them to avoid broken runtime references to libraries.
propagatedBuildInputs = [ k3sPlugins k3sBuildStage1 runc ];
# k3s appends a suffix to the final distribution binary for some arches # k3s appends a suffix to the final distribution binary for some arches
archSuffix = archSuffix =
@ -240,7 +242,7 @@ stdenv.mkDerivation rec {
]; ];
buildInputs = [ buildInputs = [
k3sBuild k3sBin
makeWrapper makeWrapper
] ++ k3sRuntimeDeps; ] ++ k3sRuntimeDeps;
@ -254,7 +256,7 @@ stdenv.mkDerivation rec {
# execute, but that we didn't bundle with it. # execute, but that we didn't bundle with it.
installPhase = '' installPhase = ''
mkdir -p "$out/bin" mkdir -p "$out/bin"
makeWrapper ${k3sBuild}/bin/k3s "$out/bin/k3s" \ makeWrapper ${k3sBin}/bin/k3s "$out/bin/k3s" \
--prefix PATH : ${lib.makeBinPath k3sRuntimeDeps} \ --prefix PATH : ${lib.makeBinPath k3sRuntimeDeps} \
--prefix PATH : "$out/bin" --prefix PATH : "$out/bin"
''; '';