Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, buildGoModule 3, fetchFromGitHub 4, git 5, installShellFiles 6}: 7 8buildGoModule rec { 9 pname = "ko"; 10 version = "0.13.0"; 11 12 src = fetchFromGitHub { 13 owner = "ko-build"; 14 repo = pname; 15 rev = "v${version}"; 16 sha256 = "sha256-KVJqqvp46BAUscG5Xj/g4ThUXKFsuJdzEB++uBskFiw="; 17 }; 18 19 vendorSha256 = 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 nativeCheckInputs = [ git ]; 29 preCheck = '' 30 # Feed in all the tests for testing 31 # This is because subPackages above limits what is built to just what we 32 # want but also limits the tests 33 getGoDirs() { 34 go list ./... 35 } 36 37 # resolves some complaints from ko 38 export GOROOT="$(go env GOROOT)" 39 git init 40 41 # ko tests will fail if any of those env are set, as ko tries 42 # to make sure it can build and target multiple GOOS/GOARCH 43 unset GOOS GOARCH GOARM 44 ''; 45 46 postInstall = '' 47 installShellCompletion --cmd ko \ 48 --bash <($out/bin/ko completion bash) \ 49 --fish <($out/bin/ko completion fish) \ 50 --zsh <($out/bin/ko completion zsh) 51 ''; 52 53 meta = with lib; { 54 homepage = "https://github.com/ko-build/ko"; 55 changelog = "https://github.com/ko-build/ko/releases/tag/v${version}"; 56 description = "Build and deploy Go applications on Kubernetes"; 57 longDescription = '' 58 ko is a simple, fast container image builder for Go applications. 59 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). 60 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. 61 ko also includes support for simple YAML templating which makes it a powerful tool for Kubernetes applications. 62 ''; 63 license = licenses.asl20; 64 maintainers = with maintainers; [ nickcao jk vdemeester developer-guy ]; 65 }; 66}