Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 79 lines 1.7 kB view raw
1{ lib 2, buildGoModule 3, fetchFromGitHub 4, installShellFiles 5, lndir 6, testers 7, regclient 8}: 9 10let bins = [ "regbot" "regctl" "regsync" ]; in 11 12buildGoModule rec { 13 pname = "regclient"; 14 version = "0.7.0"; 15 tag = "v${version}"; 16 17 src = fetchFromGitHub { 18 owner = "regclient"; 19 repo = "regclient"; 20 rev = tag; 21 sha256 = "sha256-MumOum8mG2KOSKz2wRZlbTFvgSOEpJ/qMz7+hYooPgk="; 22 }; 23 vendorHash = "sha256-gqnE3kfBLjV8CroYcJwa9QWCFOL/dBIblPQJZR2DW+4="; 24 25 outputs = [ "out" ] ++ bins; 26 27 ldflags = [ 28 "-s" 29 "-w" 30 "-X github.com/regclient/regclient/internal/version.vcsTag=${tag}" 31 ]; 32 33 nativeBuildInputs = [ installShellFiles lndir ]; 34 35 postInstall = lib.concatMapStringsSep "\n" 36 (bin: '' 37 export bin=''$${bin} 38 export outputBin=bin 39 40 mkdir -p $bin/bin 41 mv $out/bin/${bin} $bin/bin 42 43 installShellCompletion --cmd ${bin} \ 44 --bash <($bin/bin/${bin} completion bash) \ 45 --fish <($bin/bin/${bin} completion fish) \ 46 --zsh <($bin/bin/${bin} completion zsh) 47 48 lndir -silent $bin $out 49 50 unset bin outputBin 51 '') 52 bins; 53 54 checkFlags = [ 55 # touches network 56 "-skip=^ExampleNew$" 57 ]; 58 59 passthru.tests = lib.mergeAttrsList ( 60 map 61 (bin: { 62 "${bin}Version" = testers.testVersion { 63 package = regclient; 64 command = "${bin} version"; 65 version = tag; 66 }; 67 }) 68 bins 69 ); 70 71 __darwinAllowLocalNetworking = true; 72 73 meta = with lib; { 74 description = "Docker and OCI Registry Client in Go and tooling using those libraries"; 75 homepage = "https://github.com/regclient/regclient"; 76 license = licenses.asl20; 77 maintainers = with maintainers; [ maxbrunet ]; 78 }; 79}