2021-07-11 19:48:24 +02:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, terraform }:
|
2021-06-18 18:06:52 +02:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "infracost";
|
2021-07-08 07:47:22 +02:00
|
|
|
version = "0.9.3";
|
2021-06-18 18:06:52 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "infracost";
|
|
|
|
rev = "v${version}";
|
|
|
|
repo = "infracost";
|
2021-07-08 07:47:22 +02:00
|
|
|
sha256 = "sha256-3AH/VUKIno/jObep5GNfIpyOW5TcfZ5UZyornJWTGOw=";
|
2021-06-18 18:06:52 +02:00
|
|
|
};
|
2021-07-08 07:47:22 +02:00
|
|
|
vendorSha256 = "sha256-zMEtVPyzwW4SrbpydDFDqgHEC0/khkrSxlEnQ5I0he8=";
|
2021-06-18 18:06:52 +02:00
|
|
|
|
2021-07-11 19:48:24 +02:00
|
|
|
ldflags = [ "-s" "-w" "-X github.com/infracost/infracost/internal/version.Version=v${version}" ];
|
|
|
|
|
|
|
|
# Install completions post-install
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2021-06-18 18:06:52 +02:00
|
|
|
checkInputs = [ terraform ];
|
2021-07-11 19:48:24 +02:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
make test
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# panic if .config directory can't be accessed
|
|
|
|
# https://github.com/infracost/infracost/pull/862
|
|
|
|
export HOME="$TMPDIR"
|
|
|
|
mkdir -p "$HOME/.config/infracost"
|
|
|
|
export INFRACOST_SKIP_UPDATE_CHECK=true
|
|
|
|
|
|
|
|
installShellCompletion --cmd infracost \
|
|
|
|
--bash <($out/bin/infracost completion --shell bash) \
|
|
|
|
--fish <($out/bin/infracost completion --shell fish) \
|
|
|
|
--zsh <($out/bin/infracost completion --shell zsh)
|
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
export HOME="$TMPDIR"
|
|
|
|
mkdir -p "$HOME/.config/infracost"
|
|
|
|
export INFRACOST_SKIP_UPDATE_CHECK=true
|
|
|
|
|
|
|
|
$out/bin/infracost --help
|
|
|
|
$out/bin/infracost --version | grep "v${version}"
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
2021-06-18 18:06:52 +02:00
|
|
|
|
|
|
|
meta = with lib; {
|
2021-07-11 19:48:24 +02:00
|
|
|
homepage = "https://infracost.io";
|
|
|
|
changelog = "https://github.com/infracost/infracost/releases/tag/v${version}";
|
2021-06-18 18:06:52 +02:00
|
|
|
description = "Cloud cost estimates for Terraform in your CLI and pull requests";
|
2021-07-11 19:48:24 +02:00
|
|
|
longDescription = ''
|
|
|
|
Infracost shows hourly and monthly cost estimates for a Terraform project.
|
|
|
|
This helps developers, DevOps et al. quickly see the cost breakdown and
|
|
|
|
compare different deployment options upfront.
|
|
|
|
'';
|
2021-06-18 18:06:52 +02:00
|
|
|
license = [ licenses.asl20 ];
|
2021-07-11 19:48:24 +02:00
|
|
|
maintainers = with maintainers; [ davegallant jk ];
|
2021-06-18 18:06:52 +02:00
|
|
|
};
|
|
|
|
}
|