This is a bootstrapping tool that'll build, cache, and clean your environment. It's intended for use with direnv and Nix.
Install firstaide. For example, if you have installed Rust,
and cloned this repo somewhere, you can:
cargo install --path /path/to/firstaide/repoIn your project, add a .firstaide.toml configuration file with at least the
following settings:
cache_dir = "path/to/dir"
build_exe = "path/to/exe"
watch_exe = "path/to/exe"cache_dir is a directory, relative to .firstaide.toml, where firstaide will
store its cache and put other files it needs a place for. Calling firstaide clean will remove this directory, so choose wisely. It's a good idea to add
this to .gitignore too.
build_exe is an executable or script that will build your environment. It
must accept as arguments a command to be run within that environment. For
example, build_exe might point to a script like this:
#!/usr/bin/env bash
exec nix-shell --run "$(printf '%q ' "$@")"watch_exe is an executable or script that emits a null-separated list of
filenames for direnv to watch; firstaide passes these names to direnv's
watch_file function. For example, the following script would ask direnv to
watch all the files in etc and nix recursively:
#!/usr/bin/env bash
exec git ls-files -z -- etc nixAdd the following to .envrc:
eval "$(firstaide hook)"Then run firstaide build (or firstaide --help).
First, install the Rust development tools. Then:
cargo build # Compiles a debug executable.
cargo test # Compiles and tests.
cargo run # Compiles and runs a debug executable.
# ...- Bump version in
Cargo.tomlanddefault.nix. - Build and test:
cargo build && cargo test. The latter on its own does do a build, but a test build can hide warnings about dead code, so do both. - Run
nix-buildto ensure that the package builds. ThecargoSha256value may need to be updated, for example. - Commit with message "Bump version to
$VERSION." - Tag with "v
$VERSION", e.g.git tag v1.0.10. - Push:
git push && git push --tags.