2
0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-01-06 04:53:27 +00:00
nixpkgs/pkgs/tools/misc/infracost/default.nix

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

66 lines
2.0 KiB
Nix
Raw Normal View History

{ lib, buildGoModule, fetchFromGitHub, installShellFiles, terraform }:
2021-06-18 16:06:52 +00:00
buildGoModule rec {
pname = "infracost";
2022-03-17 13:20:33 +00:00
version = "0.9.20";
2021-06-18 16:06:52 +00:00
src = fetchFromGitHub {
owner = "infracost";
rev = "v${version}";
repo = "infracost";
2022-03-17 13:20:33 +00:00
sha256 = "sha256-ujoKnf6f9rrPIxvWlzVnC6q+2BxzhpXgb66clgAuC+8=";
2021-06-18 16:06:52 +00:00
};
2022-03-17 13:20:33 +00:00
vendorSha256 = "sha256-TfO3+pGxR9dPzigkx89a/Ak+tKiBa6Z0a6U4kIdRsSQ=";
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-02-16 17:17:05 +00:00
# -short only runs the unit-tests tagged short
checkFlags = [ "-short" ];
checkPhase = ''
runHook preCheck
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
# checkFlags aren't correctly passed through via buildGoModule
2022-02-16 17:17:05 +00:00
go test $checkFlags ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES ./...
2021-10-04 13:18:24 +00:00
runHook postCheck
'';
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;
maintainers = with maintainers; [ davegallant jk ];
2021-06-18 16:06:52 +00:00
};
}