nixpkgs/pkgs/by-name/ku/kubeswitch/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

53 lines
1.3 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
testers,
kubeswitch,
installShellFiles,
}:
buildGoModule rec {
pname = "kubeswitch";
version = "0.9.2";
src = fetchFromGitHub {
owner = "danielfoehrKn";
repo = "kubeswitch";
rev = version;
hash = "sha256-P6pMT3TzY5CKFEQZMiwVeOuOCx6/SUpacKAcgjCeE5w=";
};
vendorHash = null;
subPackages = [ "cmd/main.go" ];
ldflags = [
"-s"
"-w"
"-X github.com/danielfoehrkn/kubeswitch/cmd/switcher.version=${version}"
"-X github.com/danielfoehrkn/kubeswitch/cmd/switcher.buildDate=1970-01-01"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
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
'';
passthru.tests.version = testers.testVersion { package = kubeswitch; };
meta = {
changelog = "https://github.com/danielfoehrKn/kubeswitch/releases/tag/${version}";
description = "Kubectx for operators, a drop-in replacement for kubectx";
license = lib.licenses.asl20;
homepage = "https://github.com/danielfoehrKn/kubeswitch";
maintainers = with lib.maintainers; [ bryanasdev000 ];
mainProgram = "switcher";
};
}