nixpkgs/pkgs/tools/misc/infracost/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

69 lines
2.2 KiB
Nix
Raw Normal View History

2022-10-22 07:37:00 +00:00
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
2021-06-18 16:06:52 +00:00
buildGoModule rec {
pname = "infracost";
2023-10-31 17:17:08 +00:00
version = "0.10.30";
2021-06-18 16:06:52 +00:00
src = fetchFromGitHub {
owner = "infracost";
rev = "v${version}";
repo = "infracost";
2023-10-31 17:17:08 +00:00
sha256 = "sha256-YHhaOf2MNrFHv29pEnhkOjFH30Mi5Oi6gYkSH6PZhU4=";
2021-06-18 16:06:52 +00:00
};
2023-10-31 17:17:08 +00:00
vendorHash = "sha256-yjPtNTfkL8+fkmXW98SnpboMqdsjQYCif65sn0jjLgc=";
2021-06-18 16:06:52 +00:00
ldflags = [ "-s" "-w" "-X github.com/infracost/infracost/internal/version.Version=v${version}" ];
2022-02-16 17:17:05 +00:00
subPackages = [ "cmd/infracost" ];
nativeBuildInputs = [ installShellFiles ];
2022-04-13 15:02:25 +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-05-25 11:36:31 +00:00
# move to checkFlags after https://github.com/NixOS/nixpkgs/pull/173702
2022-04-13 15:02:25 +00:00
buildFlagsArray+="-short"
2021-10-04 13:18:24 +00:00
2022-03-17 13:20:33 +00:00
# remove tests that require networking
rm cmd/infracost/{breakdown,diff,hcl,run}_test.go
'';
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-18 16:06:52 +00:00
meta = with lib; {
homepage = "https://infracost.io";
changelog = "https://github.com/infracost/infracost/releases/tag/v${version}";
2021-06-18 16:06:52 +00:00
description = "Cloud cost estimates for Terraform in your CLI and pull requests";
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-15 11:55:13 +00:00
license = licenses.asl20;
2023-09-03 01:16:09 +00:00
maintainers = with maintainers; [ davegallant jk kashw2 ];
2023-11-27 01:17:53 +00:00
mainProgram = "infracost";
2021-06-18 16:06:52 +00:00
};
}