Instant, easy, and predictable go development environment
This project uses devbox to manage its development environment.
Install devbox:
curl -fsSL https://get.jetpack.io/devbox | bash
Start the devbox shell:
devbox shell
Run a script in the devbox environment:
devbox run <script>
Scripts are custom commands that can be run using this project's environment. This project has the following scripts:
GOPATH="${HOME}/go/"
LIBRARY_PATH="/home/ckihm/workspace-ckl/wasm/pluggable-calculator/.devbox/nix/profile/default/lib"
PATH="${PATH}:${HOME}/go/bin"
RUSTUP_HOME="/home/ckihm/workspace-ckl/wasm/pluggable-calculator/.devbox/virtenv/rustup"
The Shell Init Hook is a script that runs whenever the devbox environment is instantiated. It runs
on devbox shell
and on devbox run
.
test -z $DEVBOX_COREPACK_ENABLED || corepack enable --install-directory "/home/ckihm/workspace-ckl/wasm/pluggable-calculator/.devbox/virtenv/nodejs/corepack-bin/"
test -z $DEVBOX_COREPACK_ENABLED || export PATH="/home/ckihm/workspace-ckl/wasm/pluggable-calculator/.devbox/virtenv/nodejs/corepack-bin/:$PATH"
export "GOROOT=$(go env GOROOT)"
rustup default stable
cargo fetch
pushd ./plugins/src/add > /dev/null
zig build
cp ./zig-out/bin/add.wasm ../../wasm
popd > /dev/null
pushd ./plugins/src/multiply > /dev/null
cargo build --target wasm32-unknown-unknown --release
cp ./target/wasm32-unknown-unknown/release/multiply.wasm ../../wasm
popd > /dev/null
pushd ./plugins/src/power > /dev/null
tinygo build -target wasi -o power.wasm main.go
cp ./power.wasm ../../wasm
popd > /dev/null
pushd ./plugins/src/substract > /dev/null
npm run build
cp ./dist/substract.wasm ../../wasm
popd > /dev/null