workflows
A collection of useful workflows for getting a new Rust project up and running.
Usage
You'll need a Nix implementation installed on your system to work with this repo. If you don't have one already, we recommend setting up Lix.
Once installed, you can create a new project from this repo by running:
mkdir new-project
cd new-project
nix flake init -t git+https://codeberg.org/polyphony/workflows
From there, you can enter a development shell with all the tools needed to work in your project by running nix develop. If you have direnv setup on your machine, you can also run direnv allow to activate the included .envrc file, which will automatically activate the devshell while you're in the project folder.
The development shell will contain a Rust toolchain defined by the rust-toolchain.toml file polyphony.rust.toolchainFile points to in your flake. If you need specific components or targets added to the shell, add them to rust-toolchain.toml and re-enter the development shell.
treefmt, a tool for running multiple formatters over an entire repo, is configured as the flake's formatter. You can run it with either nix fmt, or by calling treefmt directly while in the development shell. By default, it's configured for the following languages:
The development shell will also setup some pre-commit hooks, using git-hooks.nix. You can also run the configured checks manually at any time with nix flake check. By default, the following checks are configured:
Both treefmt and git-hooks can be configured on a per-repo basis, using the standard flake-parts options:
The module also includes some of it's own options for configuring it's behaviour. See the generated docs for a list of options.
Dependencies
scripts/check-license-header.sh requires npx.