Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, buildGoModule, fetchFromGitHub, testers, flyctl, installShellFiles }: 2 3buildGoModule rec { 4 pname = "flyctl"; 5 version = "0.1.23"; 6 7 src = fetchFromGitHub { 8 owner = "superfly"; 9 repo = "flyctl"; 10 rev = "v${version}"; 11 hash = "sha256-ekVqY5rM/CeewZ0wnlSjWusPEQzdeVwIGdfnicMe3k8"; 12 }; 13 14 vendorHash = "sha256-7KLEfK2eZLEtOHqQxhpdQCeKVfn+rUu3i699Zk06J/U="; 15 16 subPackages = [ "." ]; 17 18 ldflags = [ 19 "-s" "-w" 20 "-X github.com/superfly/flyctl/internal/buildinfo.commit=${src.rev}" 21 "-X github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z" 22 "-X github.com/superfly/flyctl/internal/buildinfo.environment=production" 23 "-X github.com/superfly/flyctl/internal/buildinfo.version=${version}" 24 ]; 25 26 nativeBuildInputs = [ installShellFiles ]; 27 28 preBuild = '' 29 go generate ./... 30 ''; 31 32 preCheck = '' 33 HOME=$(mktemp -d) 34 ''; 35 36 postCheck = '' 37 go test ./... -ldflags="-X 'github.com/superfly/flyctl/internal/buildinfo.buildDate=1970-01-01T00:00:00Z'" 38 ''; 39 40 postInstall = '' 41 installShellCompletion --cmd flyctl \ 42 --bash <($out/bin/flyctl completion bash) \ 43 --fish <($out/bin/flyctl completion fish) \ 44 --zsh <($out/bin/flyctl completion zsh) 45 ln -s $out/bin/flyctl $out/bin/fly 46 ''; 47 48 passthru.tests.version = testers.testVersion { 49 package = flyctl; 50 command = "HOME=$(mktemp -d) flyctl version"; 51 version = "v${flyctl.version}"; 52 }; 53 54 meta = with lib; { 55 description = "Command line tools for fly.io services"; 56 downloadPage = "https://github.com/superfly/flyctl"; 57 homepage = "https://fly.io/"; 58 license = licenses.asl20; 59 maintainers = with maintainers; [ aaronjanse jsierles techknowlogick viraptor ]; 60 }; 61}