mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-04 20:13:21 +00:00
55 lines
1.5 KiB
Nix
55 lines
1.5 KiB
Nix
{ lib
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, installShellFiles
|
|
, testers
|
|
, k0sctl
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "k0sctl";
|
|
version = "0.19.4";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "k0sproject";
|
|
repo = "k0sctl";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-6zh5zd+EJpG7A4PLepBrzQKJekInkXq64XGnZS1xE7s=";
|
|
};
|
|
|
|
vendorHash = "sha256-EZ3TljEPpbpi9MZQWhmKYujXARAXawGAXez4KtRWYao=";
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X=github.com/k0sproject/k0sctl/version.Environment=production"
|
|
"-X=github.com/carlmjohnson/versioninfo.Version=v${version}" # Doesn't work currently: https://github.com/carlmjohnson/versioninfo/discussions/12
|
|
"-X=github.com/carlmjohnson/versioninfo.Revision=v${version}"
|
|
];
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
postInstall = ''
|
|
for shell in bash zsh fish; do
|
|
installShellCompletion --cmd ${pname} \
|
|
--$shell <($out/bin/${pname} completion --shell $shell)
|
|
done
|
|
'';
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
package = k0sctl;
|
|
command = "k0sctl version";
|
|
# See https://github.com/carlmjohnson/versioninfo/discussions/12
|
|
version = "version: (devel)\ncommit: v${version}\n";
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Bootstrapping and management tool for k0s clusters";
|
|
homepage = "https://k0sproject.io/";
|
|
changelog = "https://github.com/k0sproject/k0sctl/releases/tag/v${version}";
|
|
license = licenses.asl20;
|
|
mainProgram = "k0sctl";
|
|
maintainers = with maintainers; [ nickcao qjoly ];
|
|
};
|
|
}
|