1{ lib, buildGoModule, fetchFromGitHub, nix-update-script }:
2let
3 pname = "teller";
4 version = "1.5.6";
5 date = "2022-10-13";
6in
7buildGoModule {
8 inherit pname version;
9
10 src = fetchFromGitHub {
11 owner = "tellerops";
12 repo = pname;
13 rev = "v${version}";
14 hash = "sha256-vgrfWKKXf4C4qkbGiB3ndtJy1VyTx2NJs2QiOSFFZkE=";
15 };
16
17 vendorHash = null;
18
19 # use make instead of default checks because e2e does not work with `buildGoDir`
20 checkPhase = ''
21 runHook preCheck
22 HOME="$(mktemp -d)"
23 # We do not set trimpath for tests, in case they reference test assets
24 export GOFLAGS=''${GOFLAGS//-trimpath/}
25
26 make test
27
28 # e2e tests can fail on first try
29
30 max_iteration=3
31 for i in $(seq 1 $max_iteration)
32 do
33 make e2e
34 result=$?
35 if [[ $result -eq 0 ]]
36 then
37 echo "e2e tests passed"
38 break
39 else
40 echo "e2e tests failed, retrying..."
41 sleep 1
42 fi
43 done
44
45 if [[ $result -ne 0 ]]
46 then
47 echo "e2e tests failed after $max_iteration attempts"
48 fi
49
50 runHook postCheck
51 '';
52
53 passthru.updateScript = nix-update-script { };
54
55 ldflags = [
56 "-s"
57 "-w"
58 "-X main.version=${version}"
59 "-X main.commit=${version}"
60 "-X main.date=${date}"
61 ];
62
63 meta = with lib; {
64 homepage = "https://github.com/tellerops/teller/";
65 description = "Cloud native secrets management for developers";
66 license = licenses.asl20;
67 maintainers = with maintainers; [ wahtique ];
68 };
69}