nixpkgs/pkgs/development/tools/ko/default.nix

62 lines
1.9 KiB
Nix
Raw Normal View History

2021-07-14 00:24:10 +00:00
{ lib
, buildGoModule
, fetchFromGitHub
, git
, installShellFiles
2021-07-14 00:24:10 +00:00
}:
buildGoModule rec {
pname = "ko";
2022-03-22 08:25:47 +00:00
version = "0.11.2";
2021-07-14 00:24:10 +00:00
src = fetchFromGitHub {
owner = "google";
repo = pname;
rev = "v${version}";
2022-03-22 08:25:47 +00:00
sha256 = "sha256-BwK49dSt3D2BrYvluDOBYIH5qEt59HC1hssHl1D2Heg=";
2021-07-14 00:24:10 +00:00
};
vendorSha256 = null;
nativeBuildInputs = [ installShellFiles ];
# Pin so that we don't build the several other development tools
subPackages = ".";
ldflags = [ "-s" "-w" "-X github.com/google/ko/pkg/commands.Version=${version}" ];
2021-07-14 00:24:10 +00:00
checkInputs = [ git ];
preCheck = ''
# Feed in all the tests for testing
# This is because subPackages above limits what is built to just what we
# want but also limits the tests
getGoDirs() {
go list ./...
}
# resolves some complaints from ko
export GOROOT="$(go env GOROOT)"
2021-07-14 00:24:10 +00:00
git init
'';
postInstall = ''
installShellCompletion --cmd ko \
2022-03-19 20:28:24 +00:00
--bash <($out/bin/ko completion bash) \
--fish <($out/bin/ko completion fish) \
--zsh <($out/bin/ko completion zsh)
'';
2021-07-14 00:24:10 +00:00
meta = with lib; {
homepage = "https://github.com/google/ko";
changelog = "https://github.com/google/ko/releases/tag/v${version}";
description = "Build and deploy Go applications on Kubernetes";
longDescription = ''
ko is a simple, fast container image builder for Go applications.
It's ideal for use cases where your image contains a single Go application without any/many dependencies on the OS base image (e.g. no cgo, no OS package dependencies).
ko builds images by effectively executing go build on your local machine, and as such doesn't require docker to be installed. This can make it a good fit for lightweight CI/CD use cases.
ko also includes support for simple YAML templating which makes it a powerful tool for Kubernetes applications.
'';
2021-07-14 00:24:10 +00:00
license = licenses.asl20;
maintainers = with maintainers; [ nickcao jk ];
2021-07-14 00:24:10 +00:00
};
}