Add AMI publish flake app

This commit is contained in:
Timothy J. Aveni
2026-06-27 22:40:33 -07:00
parent 541a135e67
commit e66bc24def
2 changed files with 27 additions and 3 deletions
+25
View File
@@ -72,11 +72,32 @@
exec ${pkgs.nodejs_24}/bin/node ${ami-artifacts-script}/libexec/ami-artifacts/manage-amis.mjs "$@"
'';
};
publish-ami = pkgs.writeShellApplication {
name = "publish-ami";
runtimeInputs = [
pkgs.awscli2
pkgs.coreutils
pkgs.git
pkgs.jq
pkgs.opentofu
];
text = ''
git_root="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
if [ -d "$git_root/tofu/ami-builder" ]; then
ami_builder_dir="$git_root/tofu/ami-builder"
else
ami_builder_dir="$git_root"
fi
cd "$ami_builder_dir"
exec ./publish-ami.sh "$@"
'';
};
in
{
rootImage = config.system.build.images.amazon;
systemClosure = config.system.build.toplevel;
ami-artifacts = ami-artifacts;
publish-ami = publish-ami;
default = ami-artifacts;
});
@@ -85,6 +106,10 @@
type = "app";
program = "${self.packages.${system}.ami-artifacts}/bin/ami-artifacts";
};
publish-ami = {
type = "app";
program = "${self.packages.${system}.publish-ami}/bin/publish-ami";
};
});
};
}