add nix compatible build environment

This commit is contained in:
do butterflies cry? 2026-03-14 16:12:39 +10:00
parent 6e74e3bb32
commit 7640fd995a
Signed by: cry
GPG key ID: F68745A836CA0412
7 changed files with 219 additions and 0 deletions

35
scripts/serve Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Required Binaries:
# | simple-http-server
# | sass
# ===== Configuration ===== #
ADDR="127.0.0.1" # bind address
PORT="8000" # bind port
WEBROOT="www" # root web directory
USE_INDEX=true
NO_CACHE=true
declare -a SRV_ARGS=()
function host {
local args=( "$@" )
# Apply Flags
if [[ "$NO_CACHE" == true ]]; then
args+=("--nocache")
fi
if [[ "$USE_INDEX" == true ]]; then
args+=("--index")
fi
# Apply Options
args+=(--ip "$ADDR" --port "$PORT")
simple-http-server "${args[@]}" "$@" -- "$WEBROOT"
}
# trap cleanup EXIT
set -ueo pipefail
set -x
# host dev server
host "${SRV_ARGS[@]}"