Quickstart
Installing nur
If you are familiar with rust
/cargo
you may want to install nur
using cargo
:
> cargo install nur
See installation for more details on how to install nur
.
Add a nurfile
to your project
You should add a file called nurfile
to your project root folder. Add this file to version control as well, to share your tasks with your team. You can also extend the available tasks locally by adding a separate nurfile.local
file to your project.
Adding some tasks
nur
tasks are defined by using sub commands to nur
in your nurfile
, following the normal nu
syntax using def
. A simple task could look like this:
def "nur hello" [] {
print "Hello world"
}
You can then use nur hello
to execute this task. Tasks may call external command like npm ci
or poetry install
or anything else you like. Tasks can also call other tasks, see the working with nur section for more details.
All tasks will be executed in the directory the nurfile
was found in. If you place a nurfile
in your project root (git root) you will be able to call tasks from anywhere inside the project. This is useful to always have a reproducible base setup for all your tasks.
About task names
It is recommended to define and use a naming schema for your tasks. This could for example be something like:
nur install
: Setup the project, install all dependenciesnur update
: Update the project, update all dependenciesnur test
: Run all testsnur lint
: Lint the projectnur run
: Run the project, for web project start the dev server- etc.
See best practices for more details on how to structure your tasks.
Switching to nur
from any other task runner
If you are already using a task runner like just
or b5
you should read switching to nur to get an overview on how to switch to nur
.