2021-07-21 07:28:18 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, git
|
2021-08-22 07:53:02 +00:00
|
|
|
, installShellFiles
|
2021-07-21 07:28:18 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "ko";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "0.15.1";
|
2021-07-21 07:28:18 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-10-21 18:38:19 +00:00
|
|
|
owner = "ko-build";
|
2021-07-21 07:28:18 +00:00
|
|
|
repo = pname;
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-BEKsa5mzJplcyR65/4T0MizrYxEk8/ON8SDFt8ZxqMU=";
|
2021-07-21 07:28:18 +00:00
|
|
|
};
|
2023-03-15 16:39:30 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
vendorHash = null;
|
2021-10-01 09:20:50 +00:00
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
# Pin so that we don't build the several other development tools
|
|
|
|
subPackages = ".";
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
ldflags = [ "-s" "-w" "-X github.com/google/ko/pkg/commands.Version=${version}" ];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
checkFlags = [
|
|
|
|
# requires docker daemon
|
|
|
|
"-skip=TestNewPublisherCanPublish"
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ git ];
|
2021-07-21 07:28:18 +00:00
|
|
|
preCheck = ''
|
2021-10-01 09:20:50 +00:00
|
|
|
# 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 ./...
|
|
|
|
}
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
# resolves some complaints from ko
|
|
|
|
export GOROOT="$(go env GOROOT)"
|
2021-07-21 07:28:18 +00:00
|
|
|
git init
|
2022-10-21 18:38:19 +00:00
|
|
|
|
|
|
|
# ko tests will fail if any of those env are set, as ko tries
|
|
|
|
# to make sure it can build and target multiple GOOS/GOARCH
|
|
|
|
unset GOOS GOARCH GOARM
|
2021-07-21 07:28:18 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd ko \
|
2022-03-30 09:31:56 +00:00
|
|
|
--bash <($out/bin/ko completion bash) \
|
|
|
|
--fish <($out/bin/ko completion fish) \
|
|
|
|
--zsh <($out/bin/ko completion zsh)
|
2021-08-22 07:53:02 +00:00
|
|
|
'';
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
meta = with lib; {
|
2022-10-21 18:38:19 +00:00
|
|
|
homepage = "https://github.com/ko-build/ko";
|
|
|
|
changelog = "https://github.com/ko-build/ko/releases/tag/v${version}";
|
2021-08-22 07:53:02 +00:00
|
|
|
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-21 07:28:18 +00:00
|
|
|
license = licenses.asl20;
|
2023-03-08 16:32:21 +00:00
|
|
|
maintainers = with maintainers; [ nickcao jk vdemeester developer-guy ];
|
2021-07-21 07:28:18 +00:00
|
|
|
};
|
|
|
|
}
|