nixpkgs/pkgs/by-name/k0/k0sctl/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.5 KiB
Nix
Raw Normal View History

2021-07-13 08:17:37 +00:00
{ lib
2024-01-14 00:21:39 +00:00
, buildGoModule
2021-07-13 08:17:37 +00:00
, fetchFromGitHub
, installShellFiles
, testers
, k0sctl
2021-07-13 08:17:37 +00:00
}:
2024-01-14 00:21:39 +00:00
buildGoModule rec {
2021-07-13 08:17:37 +00:00
pname = "k0sctl";
version = "0.19.2";
2021-07-13 08:17:37 +00:00
src = fetchFromGitHub {
owner = "k0sproject";
repo = "k0sctl";
rev = "refs/tags/v${version}";
hash = "sha256-TdnZZ27j++o9I4Zup4PmM2VAHwn8BPBG/CwxTUy0BWU=";
2021-07-13 08:17:37 +00:00
};
2024-10-24 07:09:09 +00:00
vendorHash = "sha256-Hl/eSFbwFiuSaaPh5blWFfz6m4VNrS5mYL8ehQlb90I=";
2021-07-13 08:17:37 +00:00
2021-10-04 14:02:33 +00:00
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}"
2021-10-04 14:02:33 +00:00
];
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";
};
2021-07-13 08:17:37 +00:00
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}";
2021-07-13 08:17:37 +00:00
license = licenses.asl20;
mainProgram = "k0sctl";
maintainers = with maintainers; [ nickcao qjoly ];
2021-07-13 08:17:37 +00:00
};
}