2022-10-30 15:09:59 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "infracost";
|
2023-08-04 22:07:22 +00:00
|
|
|
version = "0.10.26";
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "infracost";
|
|
|
|
rev = "v${version}";
|
|
|
|
repo = "infracost";
|
2023-08-04 22:07:22 +00:00
|
|
|
sha256 = "sha256-Tw+peSlcnSge4xOXslsFT6UTz7NQsy1Sy89vP2YjI90=";
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
2023-08-04 22:07:22 +00:00
|
|
|
vendorHash = "sha256-nObY/79e6I5PYso917rZxwVt6pwwI5BY0nguP/1yirc=";
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
ldflags = [ "-s" "-w" "-X github.com/infracost/infracost/internal/version.Version=v${version}" ];
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
subPackages = [ "cmd/infracost" ];
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
preCheck = ''
|
|
|
|
# Feed in all tests for testing
|
|
|
|
# This is because subPackages above limits what is built to just what we
|
|
|
|
# want but also limits the tests
|
|
|
|
unset subPackages
|
|
|
|
|
|
|
|
# checkFlags aren't correctly passed through via buildGoModule so we use buildFlagsArray
|
|
|
|
# -short only runs the unit-tests tagged short
|
2022-06-16 17:23:12 +00:00
|
|
|
# move to checkFlags after https://github.com/NixOS/nixpkgs/pull/173702
|
2022-04-15 01:41:22 +00:00
|
|
|
buildFlagsArray+="-short"
|
2021-10-06 13:57:05 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
# remove tests that require networking
|
|
|
|
rm cmd/infracost/{breakdown,diff,hcl,run}_test.go
|
2021-07-14 22:03:04 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
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 INFRACOST_SKIP_UPDATE_CHECK=true
|
|
|
|
$out/bin/infracost --help
|
|
|
|
$out/bin/infracost --version | grep "v${version}"
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2021-07-14 22:03:04 +00:00
|
|
|
homepage = "https://infracost.io";
|
|
|
|
changelog = "https://github.com/infracost/infracost/releases/tag/v${version}";
|
2021-06-28 23:13:55 +00:00
|
|
|
description = "Cloud cost estimates for Terraform in your CLI and pull requests";
|
2021-07-14 22:03:04 +00: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-07-16 19:40:57 +00:00
|
|
|
license = licenses.asl20;
|
2021-07-14 22:03:04 +00:00
|
|
|
maintainers = with maintainers; [ davegallant jk ];
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
|
|
|
}
|