nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 makeWrapper,
6 installShellFiles,
7 getent,
8 nix-update-script,
9 testers,
10 prometheus-php-fpm-exporter,
11}:
12
13buildGoModule rec {
14 pname = "php-fpm_exporter";
15 version = "2.2.0";
16
17 src = fetchFromGitHub {
18 owner = "hipages";
19 repo = pname;
20 rev = "v${version}";
21 hash = "sha256-ggrFnyEdGBoZVh4dHMw+7RUm8nJ1hJXo/fownO3wvzE=";
22 };
23
24 vendorHash = "sha256-OK36tHkBtosdfEWFPYMtlbzCkh5cF35NBWYyJrb9fwg=";
25
26 nativeBuildInputs = [
27 makeWrapper
28 installShellFiles
29 ];
30
31 ldflags = [
32 "-X main.version=${version}"
33 ];
34
35 preFixup = ''
36 wrapProgram "$out/bin/php-fpm_exporter" \
37 --prefix PATH ":" "${lib.makeBinPath [ getent ]}"
38 '';
39
40 postInstall = ''
41 installShellCompletion --cmd php-fpm_exporter \
42 --bash <($out/bin/php-fpm_exporter completion bash) \
43 --fish <($out/bin/php-fpm_exporter completion fish) \
44 --zsh <($out/bin/php-fpm_exporter completion zsh)
45 '';
46
47 passthru = {
48 updateScript = nix-update-script { };
49 tests = testers.testVersion {
50 inherit version;
51 package = prometheus-php-fpm-exporter;
52 command = "php-fpm_exporter version";
53 };
54 };
55
56 meta = {
57 homepage = "https://github.com/hipages/php-fpm_exporter";
58 description = "Prometheus exporter for PHP-FPM";
59 license = lib.licenses.asl20;
60 maintainers = [ ];
61 mainProgram = "php-fpm_exporter";
62 };
63}