Skip to content

Bootstrap tool for Nix environments. See NoRedInk's firstaide repo for future development! https://github.com/NoRedInk/firstaide

Notifications You must be signed in to change notification settings

allenap/firstaide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

firstaide

Build Status

This is a bootstrapping tool that'll build, cache, and clean your environment. It's intended for use with direnv and Nix.

How to use:

Install firstaide. For example, if you have installed Rust, and cloned this repo somewhere, you can:

cargo install --path /path/to/firstaide/repo

In 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 nix

Add the following to .envrc:

eval "$(firstaide hook)"

Then run firstaide build (or firstaide --help).

To develop:

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.
# ...

Making a release

  1. Bump version in Cargo.toml and default.nix.
  2. 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.
  3. Run nix-build to ensure that the package builds. The cargoSha256 value may need to be updated, for example.
  4. Commit with message "Bump version to $VERSION."
  5. Tag with "v$VERSION", e.g. git tag v1.0.10.
  6. Push: git push && git push --tags.

About

Bootstrap tool for Nix environments. See NoRedInk's firstaide repo for future development! https://github.com/NoRedInk/firstaide

Resources

Stars

Watchers

Forks

Packages

No packages published