Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 buildGoModule, 4 fetchFromGitHub, 5 go, 6 prometheus-sql-exporter, 7 testers, 8}: 9 10buildGoModule rec { 11 pname = "sql_exporter"; 12 version = "0.8"; 13 14 src = fetchFromGitHub { 15 owner = "justwatchcom"; 16 repo = pname; 17 rev = "v${version}"; 18 sha256 = "sha256-6aJ1vBhRgHmWFoEB1pd+mCqeb1y7G91HshcZ7ehf35w="; 19 }; 20 21 vendorHash = null; 22 23 ldflags = 24 let 25 t = "github.com/prometheus/common/version"; 26 in 27 [ 28 "-X ${t}.Version=${version}" 29 "-X ${t}.Revision=${src.rev}" 30 "-X ${t}.Branch=unknown" 31 "-X ${t}.BuildUser=nix@nixpkgs" 32 "-X ${t}.BuildDate=unknown" 33 "-X ${t}.GoVersion=${lib.getVersion go}" 34 ]; 35 36 passthru.tests.version = testers.testVersion { 37 package = prometheus-sql-exporter; 38 command = "sql_exporter -version"; 39 }; 40 41 meta = with lib; { 42 description = "Flexible SQL exporter for Prometheus"; 43 mainProgram = "sql_exporter"; 44 homepage = "https://github.com/justwatchcom/sql_exporter"; 45 license = licenses.mit; 46 maintainers = with maintainers; [ justinas ]; 47 }; 48}