-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab666e8
commit 23381e7
Showing
1 changed file
with
31 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,57 @@ | ||
{ lib, buildGoModule, fetchFromGitHub, nix-update-script }: | ||
{ | ||
lib, | ||
rustPlatform, | ||
fetchFromGitHub, | ||
nix-update-script, | ||
protobuf, | ||
stdenv, | ||
darwin, | ||
pkg-config, | ||
openssl, | ||
}: | ||
let | ||
pname = "teller"; | ||
version = "1.5.6"; | ||
date = "2022-10-13"; | ||
version = "2.0.7"; | ||
date = "2024-05-19"; | ||
in | ||
buildGoModule { | ||
rustPlatform.buildRustPackage { | ||
inherit pname version; | ||
|
||
src = fetchFromGitHub { | ||
owner = "tellerops"; | ||
repo = pname; | ||
rev = "v${version}"; | ||
hash = "sha256-vgrfWKKXf4C4qkbGiB3ndtJy1VyTx2NJs2QiOSFFZkE="; | ||
hash = "sha256-CI74nMMTIPwjJfy7ASR19V6EbYZ62NoAOxlP3Xt2BuI="; | ||
}; | ||
|
||
vendorHash = null; | ||
cargoHash = "sha256-iqZX+9l3TWrFuaQreNz4RrCgPQCyKJt6RJ1UeKYaNRs="; | ||
|
||
# use make instead of default checks because e2e does not work with `buildGoDir` | ||
checkPhase = '' | ||
runHook preCheck | ||
HOME="$(mktemp -d)" | ||
# We do not set trimpath for tests, in case they reference test assets | ||
export GOFLAGS=''${GOFLAGS//-trimpath/} | ||
make test | ||
# e2e tests can fail on first try | ||
nativeBuildInputs = [ | ||
protobuf | ||
pkg-config | ||
]; | ||
|
||
max_iteration=3 | ||
for i in $(seq 1 $max_iteration) | ||
do | ||
make e2e | ||
result=$? | ||
if [[ $result -eq 0 ]] | ||
then | ||
echo "e2e tests passed" | ||
break | ||
else | ||
echo "e2e tests failed, retrying..." | ||
sleep 1 | ||
fi | ||
done | ||
buildInputs = [ | ||
openssl | ||
] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.SystemConfiguration ]; | ||
|
||
if [[ $result -ne 0 ]] | ||
then | ||
echo "e2e tests failed after $max_iteration attempts" | ||
fi | ||
doCheck = false; | ||
|
||
runHook postCheck | ||
doInstallCheck = true; | ||
installCheckPhase = '' | ||
$out/bin/teller --version 2>&1 | grep ${version}; | ||
''; | ||
|
||
passthru.updateScript = nix-update-script { }; | ||
|
||
ldflags = [ | ||
"-s" | ||
"-w" | ||
"-X main.version=${version}" | ||
"-X main.commit=${version}" | ||
"-X main.date=${date}" | ||
]; | ||
|
||
meta = with lib; { | ||
homepage = "https://github.com/tellerops/teller/"; | ||
description = "Cloud native secrets management for developers"; | ||
mainProgram = "teller"; | ||
license = licenses.asl20; | ||
maintainers = with maintainers; [ wahtique ]; | ||
maintainers = with maintainers; [ | ||
cameronraysmith | ||
wahtique | ||
]; | ||
}; | ||
} |