nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 nixosTests,
6
7 # Test dependencies
8 redisTestHook,
9}:
10
11buildGoModule rec {
12 pname = "redis_exporter";
13 version = "1.80.0";
14
15 src = fetchFromGitHub {
16 owner = "oliver006";
17 repo = "redis_exporter";
18 rev = "v${version}";
19 sha256 = "sha256-52MOgevF5UtyP6c+lsStNeF7/Z1H2jcIYqSzq5mhdpA=";
20 };
21
22 vendorHash = "sha256-MkwkwfH7/hqJ89soHOGeR8iznXoNb/5Rbyg6tqcEhOg=";
23
24 ldflags = [
25 "-X main.BuildVersion=${version}"
26 "-X main.BuildCommitSha=unknown"
27 "-X main.BuildDate=unknown"
28 ];
29
30 nativeCheckInputs = [
31 redisTestHook
32 ];
33
34 preCheck = ''
35 export TEST_REDIS_URI="redis://localhost:6379"
36 '';
37
38 __darwinAllowLocalNetworking = true;
39
40 checkFlags =
41 let
42 skippedTests = [
43 "TestLatencySpike" # timing-sensitive
44
45 # The following tests require ad-hoc generated TLS certificates in the source dir.
46 # This is not possible in the read-only Nix store.
47 "TestCreateClientTLSConfig"
48 "TestValkeyTLSScheme"
49 "TestCreateServerTLSConfig"
50 "TestGetServerCertificateFunc"
51 "TestGetConfigForClientFunc"
52 ];
53 in
54 [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
55
56 passthru.tests = { inherit (nixosTests.prometheus-exporters) redis; };
57
58 meta = {
59 description = "Prometheus exporter for Redis metrics";
60 mainProgram = "redis_exporter";
61 homepage = "https://github.com/oliver006/redis_exporter";
62 license = lib.licenses.mit;
63 maintainers = with lib.maintainers; [
64 eskytthe
65 srhb
66 ma27
67 ];
68 };
69}