2024-04-12 00:44:51 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildGoModule,
|
|
|
|
fetchFromGitHub,
|
|
|
|
testers,
|
|
|
|
kubeswitch,
|
|
|
|
installShellFiles,
|
|
|
|
}:
|
2022-09-21 07:31:44 +02:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "kubeswitch";
|
2024-04-21 08:17:54 +02:00
|
|
|
version = "0.9.1";
|
2022-09-21 07:31:44 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "danielfoehrKn";
|
2024-04-12 00:44:51 +02:00
|
|
|
repo = "kubeswitch";
|
2022-09-21 07:31:44 +02:00
|
|
|
rev = version;
|
2024-04-21 08:17:54 +02:00
|
|
|
hash = "sha256-cvMTuiXSpx+ZicN1P3JjGExzW7d51nN1YIpsGArXHzw=";
|
2022-09-21 07:31:44 +02:00
|
|
|
};
|
|
|
|
|
2023-08-06 08:38:14 +02:00
|
|
|
vendorHash = null;
|
2022-09-21 07:31:44 +02:00
|
|
|
|
|
|
|
subPackages = [ "cmd/main.go" ];
|
|
|
|
|
|
|
|
ldflags = [
|
2024-04-12 00:44:51 +02:00
|
|
|
"-s"
|
|
|
|
"-w"
|
2022-09-21 07:31:44 +02:00
|
|
|
"-X github.com/danielfoehrkn/kubeswitch/cmd/switcher.version=${version}"
|
|
|
|
"-X github.com/danielfoehrkn/kubeswitch/cmd/switcher.buildDate=1970-01-01"
|
|
|
|
];
|
|
|
|
|
2024-04-12 00:44:51 +02:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
2022-09-21 07:31:44 +02:00
|
|
|
|
|
|
|
postInstall = ''
|
2024-04-12 00:44:51 +02:00
|
|
|
mv $out/bin/main $out/bin/switcher
|
|
|
|
for shell in bash zsh fish; do
|
|
|
|
$out/bin/switcher --cmd switcher completion $shell > switcher.$shell
|
|
|
|
installShellCompletion --$shell switcher.$shell
|
|
|
|
done
|
2022-09-21 07:31:44 +02:00
|
|
|
'';
|
|
|
|
|
2024-04-12 00:44:51 +02:00
|
|
|
passthru.tests.version = testers.testVersion { package = kubeswitch; };
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
changelog = "https://github.com/danielfoehrKn/kubeswitch/releases/tag/${version}";
|
|
|
|
description = "The kubectx for operators, a drop-in replacement for kubectx";
|
|
|
|
license = lib.licenses.asl20;
|
2022-09-21 07:31:44 +02:00
|
|
|
homepage = "https://github.com/danielfoehrKn/kubeswitch";
|
2024-04-12 00:44:51 +02:00
|
|
|
maintainers = with lib.maintainers; [ bryanasdev000 ];
|
|
|
|
mainProgram = "switcher";
|
2022-09-21 07:31:44 +02:00
|
|
|
};
|
|
|
|
}
|