This repository contains a simple static site generator for hicksca.dev, built using Lua.
.
├── .github/
│ └── workflows/
│ └── publish.yml
├── assets/
│ ├── css/
│ │ └── style.css
│ └── img/
│ └── (various image files)
├── content/
│ └── about.md
├── nix/
│ └── pkgs.nix
├── templates/
│ └── template.html
├── .dockerignore
├── .gitignore
├── default.nix
├── Dockerfile
├── license
├── publish.sh
├── README.md
├── shell.nix
└── staticGen.lua(not all this needs to be push will clean this up mostly for ref at the moment)
nix related commands are optional you can manuall install lua and dependances
- lua (LuaRocks)
- luafilesystem
- html-tidy
- Clone this repository.
- Run
nix-shellto set up the development environment and manage dependencies. - Generator script is
staticGen.lua.
- Edit the content in
content/about.md. - Modify the HTML template in
templates/template.htmlif needed. - Run the generator:
lua staticGen.lua
- The generator will create an
index.htmlfile based on the content and template.
The site can also be built and served from a container with Nix as the base (nixos/nix).
nix/pkgs.nixpins nixpkgs so builds are reproducibledefault.nixrunsstaticGen.luaas a Nix build and bundles the output withdarkhttpd
- Build the image:
docker build -t hicksca.dev . - Run it:
docker run --rm -t -p 8080:8080 hicksca.dev
- Preview at http://localhost:8080 (Ctrl+C to stop).
Note: template.html sets <base href="https://hicksca.dev/"> so css/images load from the live site when previewing locally.
Site is hosted on srht.site and published with hut.
- One time setup, run
hut initand paste a personal token with themeta.sr.ht/PROFILE:ROandpages.sr.ht/PAGES:RWgrants. - Build and publish:
Or build
./publish.sh
site.tar.gzonly without publishing:PUBLISH=0 ./publish.sh
publish.sh builds the image, pulls the generated site out of the container as site.tar.gz, checks it has an index.html, then runs hut pages publish. DOMAIN and IMAGE can be overridden the same way as PUBLISH.
Pushing to main runs .github/workflows/publish.yml on GitHub Actions, which installs hut and runs publish.sh. It can also be started by hand from the Actions tab (Run workflow).
- Needs a repo secret
SRHT_TOKEN(Settings > Secrets and variables > Actions) holding a sr.ht token with thepages.sr.ht/PAGES:RWgrant - Use a separate token from the local
hut initone so either can be revoked on its own - sr.ht tokens expire, if publishing starts failing on auth swap in a new token
- Set up Git hook to deploy to local test environment
- Implement basic automated testing/linting
Wrap build + publish into apublish.shPublish on push tomainwith GitHub Actions
(more stuff to come as I think about it ...)