1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-15 17:50:53 +00:00
flake-parts/examples/project-commands
2023-06-30 09:31:36 +02:00
..
flake.lock docs: add commands example 2023-06-24 08:16:31 +02:00
flake.nix docs: add commands example 2023-06-24 08:16:31 +02:00
Hello.avdl docs: add commands example 2023-06-24 08:16:31 +02:00
README.md docs: update to comments 2023-06-30 09:31:36 +02:00

project-commands

Warning

If you copy the flake.nix remember to git add [-N|--intent-to-add] flake.nix, otherwise it won't work

This example shows how to create scripts for your project, by leveraging mission-control

This is a potential alternative to:

  • Using a Makefile to manage your project's scripts
  • Using the popular Scripts To Rule Them All; a naming convention for a scripts/ directory
  • Using a bin/ directory

Explanation

In this example we use the avro-tools to convert our scripts from .avdl to .avsc.

You don't need to know anything about avro to understand mission-control and use this example (that's Nix baby 🚀).

When setting up mission-control, we add one script called build. Because of wrapperName = "run";, once we open the shell created by nix, the commands will be listed as run build.

mission-control depends on flake-root, which also exposes the helpful $FLAKE_ROOT variable.

After creating the scripts, we need to pass the newly created scripts to the desired shell, in this example we use the default shell.

Usage

Run:

nix develop

And mission-control will print in the new shell the available commands (you should see only one).

Try running

run build