at 23.11-beta 71 lines 2.3 kB view raw
1{ lib 2, buildGoModule 3, fetchFromGitHub 4, git 5, installShellFiles 6}: 7 8buildGoModule rec { 9 pname = "ko"; 10 version = "0.15.1"; 11 12 src = fetchFromGitHub { 13 owner = "ko-build"; 14 repo = pname; 15 rev = "refs/tags/v${version}"; 16 hash = "sha256-BEKsa5mzJplcyR65/4T0MizrYxEk8/ON8SDFt8ZxqMU="; 17 }; 18 19 vendorHash = null; 20 21 nativeBuildInputs = [ installShellFiles ]; 22 23 # Pin so that we don't build the several other development tools 24 subPackages = "."; 25 26 ldflags = [ "-s" "-w" "-X github.com/google/ko/pkg/commands.Version=${version}" ]; 27 28 checkFlags = [ 29 # requires docker daemon 30 "-skip=TestNewPublisherCanPublish" 31 ]; 32 33 nativeCheckInputs = [ git ]; 34 preCheck = '' 35 # Feed in all the tests for testing 36 # This is because subPackages above limits what is built to just what we 37 # want but also limits the tests 38 getGoDirs() { 39 go list ./... 40 } 41 42 # resolves some complaints from ko 43 export GOROOT="$(go env GOROOT)" 44 git init 45 46 # ko tests will fail if any of those env are set, as ko tries 47 # to make sure it can build and target multiple GOOS/GOARCH 48 unset GOOS GOARCH GOARM 49 ''; 50 51 postInstall = '' 52 installShellCompletion --cmd ko \ 53 --bash <($out/bin/ko completion bash) \ 54 --fish <($out/bin/ko completion fish) \ 55 --zsh <($out/bin/ko completion zsh) 56 ''; 57 58 meta = with lib; { 59 homepage = "https://github.com/ko-build/ko"; 60 changelog = "https://github.com/ko-build/ko/releases/tag/v${version}"; 61 description = "Build and deploy Go applications on Kubernetes"; 62 longDescription = '' 63 ko is a simple, fast container image builder for Go applications. 64 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). 65 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. 66 ko also includes support for simple YAML templating which makes it a powerful tool for Kubernetes applications. 67 ''; 68 license = licenses.asl20; 69 maintainers = with maintainers; [ nickcao jk vdemeester developer-guy ]; 70 }; 71}