nixpkgs/pkgs/applications/networking/cluster/kops/default.nix
stuebinm ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00

70 lines
1.9 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
let
generic = { version, sha256, rev ? version, ... }@attrs:
let attrs' = builtins.removeAttrs attrs [ "version" "sha256" "rev" ]; in
buildGoModule
{
pname = "kops";
inherit version;
src = fetchFromGitHub {
rev = rev;
owner = "kubernetes";
repo = "kops";
inherit sha256;
};
vendorHash = null;
nativeBuildInputs = [ installShellFiles ];
subPackages = [ "cmd/kops" ];
ldflags = [
"-s"
"-w"
"-X k8s.io/kops.Version=${version}"
"-X k8s.io/kops.GitVersion=${version}"
];
doCheck = false;
postInstall = ''
installShellCompletion --cmd kops \
--bash <($GOPATH/bin/kops completion bash) \
--fish <($GOPATH/bin/kops completion fish) \
--zsh <($GOPATH/bin/kops completion zsh)
'';
meta = with lib; {
description = "Easiest way to get a production Kubernetes up and running";
mainProgram = "kops";
homepage = "https://github.com/kubernetes/kops";
changelog = "https://github.com/kubernetes/kops/tree/master/docs/releases";
license = licenses.asl20;
maintainers = with maintainers; [ offline zimbatm diegolelis yurrriq ];
};
} // attrs';
in
rec {
mkKops = generic;
kops_1_26 = mkKops rec {
version = "1.26.6";
sha256 = "sha256-qaehvPgB3phZl/K577hig4G4RxAUi6Im94vXP5ctnWM=";
rev = "v${version}";
};
kops_1_27 = mkKops rec {
version = "1.27.1";
sha256 = "sha256-WV+0380yj8GHckY4PDM3WspbZ/YuYZOAQEMd2ygEOjo=";
rev = "v${version}";
};
kops_1_28 = mkKops rec {
version = "1.28.4";
sha256 = "sha256-nknsrLdV7tQKLOir5RM3LRhTS+dyiAc1GjbByJzjwCo=";
rev = "v${version}";
};
}