kubernetes: switch to buildGoModule

main
zowoq 2 years ago
parent 7f8734e9b7
commit 47db3772a7
  1. 31
      pkgs/applications/networking/cluster/kubernetes/default.nix
  2. 13
      pkgs/applications/networking/cluster/kubernetes/kubectl.nix

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

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

Loading…
Cancel
Save