40 lines
936 B
Makefile
40 lines
936 B
Makefile
# Always use devbox environment to run commands.
|
|
set shell := ["devbox", "run"]
|
|
# Load dotenv
|
|
set dotenv-load
|
|
|
|
export TENV_AUTO_INSTALL := "true"
|
|
|
|
default:
|
|
@just --list
|
|
|
|
lint:
|
|
@tofu fmt -check -recursive .
|
|
@tflint --recursive
|
|
|
|
build:
|
|
@nix build .#vm
|
|
|
|
push:
|
|
#!/usr/bin/env sh
|
|
export NIXOS_IMAGE=$(nix path-info --quiet .#vm)/nixos.qcow2
|
|
export VERSION=$(echo $NIXOS_IMAGE | cut -d'/' -f4 | cut -d'-' -f1)
|
|
|
|
echo "Uploading $NIXOS_IMAGE to code.tjo.space"
|
|
echo "Version: $VERSION"
|
|
|
|
curl --user $CODE_TJO_SPACE_USER:$CODE_TJO_SPACE_TOKEN \
|
|
--progress-bar \
|
|
--upload-file $NIXOS_IMAGE \
|
|
https://code.tjo.space/api/packages/tjo-cloud/generic/ingress/${VERSION}/nixos.qcow2
|
|
|
|
deploy: build
|
|
#!/usr/bin/env sh
|
|
export NIXOS_IMAGE=$(nix path-info --quiet .#vm)/nixos.qcow2
|
|
export TF_VAR_image_path=$NIXOS_IMAGE
|
|
|
|
echo "Deploying $NIXOS_IMAGE"
|
|
|
|
cd {{justfile_directory()}}/terraform
|
|
tofu init
|
|
tofu apply
|