Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 61 lines 1.5 kB view raw
1{ 2 lib, 3 buildGoModule, 4 fetchFromGitHub, 5 installShellFiles, 6 testers, 7 clusterctl, 8}: 9 10buildGoModule rec { 11 pname = "clusterctl"; 12 version = "1.10.4"; 13 14 src = fetchFromGitHub { 15 owner = "kubernetes-sigs"; 16 repo = "cluster-api"; 17 rev = "v${version}"; 18 hash = "sha256-MMwM1hWZd1DdiymRAJrcFD4YoLqP0wrgDV5oIv7Lkxo="; 19 }; 20 21 vendorHash = "sha256-YFtlu9ml7ZHG+m8se4K229+kzbiBZ4+dcJhFFIH7XgA="; 22 23 subPackages = [ "cmd/clusterctl" ]; 24 25 nativeBuildInputs = [ installShellFiles ]; 26 27 ldflags = 28 let 29 t = "sigs.k8s.io/cluster-api/version"; 30 in 31 [ 32 "-X ${t}.gitMajor=${lib.versions.major version}" 33 "-X ${t}.gitMinor=${lib.versions.minor version}" 34 "-X ${t}.gitVersion=v${version}" 35 ]; 36 37 postInstall = '' 38 # errors attempting to write config to read-only $HOME 39 export HOME=$TMPDIR 40 41 installShellCompletion --cmd clusterctl \ 42 --bash <($out/bin/clusterctl completion bash) \ 43 --fish <($out/bin/clusterctl completion fish) \ 44 --zsh <($out/bin/clusterctl completion zsh) 45 ''; 46 47 passthru.tests.version = testers.testVersion { 48 package = clusterctl; 49 command = "HOME=$TMPDIR clusterctl version"; 50 version = "v${version}"; 51 }; 52 53 meta = { 54 changelog = "https://github.com/kubernetes-sigs/cluster-api/releases/tag/${src.rev}"; 55 description = "Kubernetes cluster API tool"; 56 mainProgram = "clusterctl"; 57 homepage = "https://cluster-api.sigs.k8s.io/"; 58 license = lib.licenses.asl20; 59 maintainers = with lib.maintainers; [ qjoly ]; 60 }; 61}