Added new recipe to justfile

- upload-image recipe added to upload built images
- Added .env file to hold Linode API token
- Update .gitignore file to ignore local changes of .env
This commit is contained in:
Andrew Bryant 2025-11-29 19:52:01 -05:00
parent a58aa119f8
commit a3c8a3a46b
3 changed files with 29 additions and 0 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
API_TOKEN=

1
.gitignore vendored
View File

@ -1 +1,2 @@
result
.env

View File

@ -1,5 +1,21 @@
set dotenv-required
set quiet := true
UPLOAD_URL := ```
curl -s -X POST \
--url https://api.linode.com/v4/images/upload \
--header 'accept: application/json' \
--header "authorization: Bearer $API_TOKEN" \
--header 'content-type: application/json' \
--data '
{
"description": "nixos",
"label": "nixos",
"region": "us-iad"
}
' | jq .upload_to
```
[private]
_default:
just --list
@ -8,7 +24,18 @@ _default:
_clean:
rm -f result
[private]
_image_exists:
[ -f result/linode-image.img.gz ] \
|| echo "Linode image not found."
[doc('Builds Linode compatible NixOS disk image.')]
build-image: _clean
nix build ".#nixosConfigurations.linode-image.config.system.build.raw"
[doc('Uploads NixOS compatible disk image to Linode.')]
upload-image: _image_exists
curl -X PUT \
--url {{UPLOAD_URL}} \
-T result/linode-image.img.gz