Files
nixpkgs/pkgs/by-name/aw/aws-nuke/package.nix
2026-06-04 07:14:36 +00:00

66 lines
1.7 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
stdenv,
versionCheckHook,
nix-update-script,
}:
buildGoModule (finalAttrs: {
pname = "aws-nuke";
version = "3.65.0";
src = fetchFromGitHub {
owner = "ekristen";
repo = "aws-nuke";
tag = "v${finalAttrs.version}";
hash = "sha256-1C7vA/5fUw+RHK1m3MvxY6bTzG1m3PpsXTNow4mkWL4=";
};
vendorHash = "sha256-q1ASHG4KWlU8tLjHireMqmkW33Q2hy+ikOTWQPOYIXo=";
subPackages = [ "." ];
ldflags = [
"-s"
"-w"
"-X=github.com/ekristen/aws-nuke/v${lib.versions.major finalAttrs.version}/pkg/common.SUMMARY=${finalAttrs.version}"
];
nativeBuildInputs = [ installShellFiles ];
doCheck = false;
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd aws-nuke \
--bash <($out/bin/aws-nuke completion bash) \
--fish <($out/bin/aws-nuke completion fish) \
--zsh <($out/bin/aws-nuke completion zsh)
'';
doInstallCheck = true;
nativeInstallCheckInputs = [
versionCheckHook
];
postInstallCheck = ''
$out/bin/aws-nuke resource-types | grep "IAMUser"
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "Remove all the resources from an AWS account";
homepage = "https://github.com/ekristen/aws-nuke";
changelog = "https://github.com/ekristen/aws-nuke/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.mit;
mainProgram = "aws-nuke";
# fork/exec exe/mockgen: exec format error
# resources/autoscaling_mock_test.go:1: running "../mocks/generate_mocks.sh": exit status 1
broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
};
})