nixpkgs/pkgs/by-name/k0/k0sctl/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

55 lines
1.5 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, testers
, k0sctl
}:
buildGoModule rec {
pname = "k0sctl";
version = "0.19.2";
src = fetchFromGitHub {
owner = "k0sproject";
repo = "k0sctl";
rev = "refs/tags/v${version}";
hash = "sha256-TdnZZ27j++o9I4Zup4PmM2VAHwn8BPBG/CwxTUy0BWU=";
};
vendorHash = "sha256-Hl/eSFbwFiuSaaPh5blWFfz6m4VNrS5mYL8ehQlb90I=";
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 ];
};
}