kubernetes: switch to buildGoModule

This commit is contained in:
zowoq 2022-06-21 18:38:36 +10:00
parent 7f8734e9b7
commit 47db3772a7
2 changed files with 21 additions and 23 deletions

View file

@ -1,11 +1,11 @@
{ stdenv { lib
, lib , buildGoModule
, fetchFromGitHub , fetchFromGitHub
, which , which
, go
, makeWrapper , makeWrapper
, rsync , rsync
, installShellFiles , installShellFiles
, runtimeShell
, kubectl , kubectl
, nixosTests , nixosTests
@ -19,7 +19,7 @@
] ]
}: }:
stdenv.mkDerivation rec { buildGoModule rec {
pname = "kubernetes"; pname = "kubernetes";
version = "1.23.8"; version = "1.23.8";
@ -30,23 +30,27 @@ stdenv.mkDerivation rec {
sha256 = "sha256-mu+jBSypoMNxOugLbS3foH4C4AqSZnlic4Bf1v9dYc8="; sha256 = "sha256-mu+jBSypoMNxOugLbS3foH4C4AqSZnlic4Bf1v9dYc8=";
}; };
nativeBuildInputs = [ makeWrapper which go rsync installShellFiles ]; vendorSha256 = null;
doCheck = false;
nativeBuildInputs = [ makeWrapper which rsync installShellFiles ];
outputs = [ "out" "man" "pause" ]; outputs = [ "out" "man" "pause" ];
patches = [ ./fixup-addonmanager-lib-path.patch ]; patches = [ ./fixup-addonmanager-lib-path.patch ];
postPatch = ''
substituteInPlace "hack/update-generated-docs.sh" --replace "make" "make SHELL=${stdenv.shell}"
patchShebangs ./hack
'';
WHAT = lib.concatStringsSep " " ([ WHAT = lib.concatStringsSep " " ([
"cmd/kubeadm" "cmd/kubeadm"
] ++ components); ] ++ components);
postBuild = '' buildPhase = ''
runHook preBuild
substituteInPlace "hack/update-generated-docs.sh" --replace "make" "make SHELL=${runtimeShell}"
patchShebangs ./hack ./cluster/addons/addon-manager
make "SHELL=${runtimeShell}" "WHAT=$WHAT"
./hack/update-generated-docs.sh ./hack/update-generated-docs.sh
runHook postBuild
''; '';
installPhase = '' installPhase = ''
@ -69,7 +73,6 @@ stdenv.mkDerivation rec {
--subst-var out --subst-var out
chmod +x $out/bin/kube-addons chmod +x $out/bin/kube-addons
patchShebangs $out/bin/kube-addons
wrapProgram $out/bin/kube-addons --set "KUBECTL_BIN" "$out/bin/kubectl" wrapProgram $out/bin/kube-addons --set "KUBECTL_BIN" "$out/bin/kubectl"
cp cluster/addons/addon-manager/kube-addons.sh $out/bin/kube-addons-lib.sh cp cluster/addons/addon-manager/kube-addons.sh $out/bin/kube-addons-lib.sh
@ -80,10 +83,6 @@ stdenv.mkDerivation rec {
runHook postInstall runHook postInstall
''; '';
disallowedReferences = [ go ];
GOFLAGS = [ "-trimpath" ];
meta = with lib; { meta = with lib; {
description = "Production-Grade Container Scheduling and Management"; description = "Production-Grade Container Scheduling and Management";
license = licenses.asl20; license = licenses.asl20;

View file

@ -1,15 +1,14 @@
{ lib, stdenv, kubernetes }: { lib, buildGoModule, kubernetes }:
stdenv.mkDerivation rec { buildGoModule rec {
pname = "kubectl"; pname = "kubectl";
inherit (kubernetes) inherit (kubernetes)
disallowedReferences buildPhase
GOFLAGS doCheck
nativeBuildInputs nativeBuildInputs
postBuild
postPatch
src src
vendorSha256
version version
; ;
@ -18,7 +17,7 @@ stdenv.mkDerivation rec {
WHAT = lib.concatStringsSep " " [ WHAT = lib.concatStringsSep " " [
"cmd/kubectl" "cmd/kubectl"
"cmd/kubectl-convert" "cmd/kubectl-convert"
]; ];
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall