Getting started

To start using Clean and Nitrile, you need to install Nitrile. Nitrile can then manage different versions of the base packages (like the compiler, code generator, and run time system) in each project. You do not have a global Clean installation. This enables you to work with different versions of applications and libraries at the same time.

Installing Nitrile

To install Nitrile, follow the instructions on the Clean website.

You may also want to set up your editor with one of the plugins.

Alternatively, you can download the build artifacts for the latest tag from GitLab and place the nitrile executable somewhere in your path.

To build Nitrile from source, you need either a working Nitrile installation or a working Clean installation.

Creating and building projects

Nitrile works with projects, which are specified in a nitrile.yml file. The contents of this file are documented here.

To get started, create a simple nitrile.yml file (or use nitrile init):

name: my-project
type: Application
description: An example project.
version: 0.1.0
license: AGPL-3.0-only
url: https://gitlab.com/example/my-project
maintainer: My Name
contact_email: name@example.org

Also create the directory src and a main file src/app.icl:

module app

Start = "Hello, world!"

We need to tell Nitrile where to look for the source files. Add the following to your nitrile.yml:

src:
  - src
build:
  app:
    script:
      - clm:
          main: app
          target: bin/app

If we now run nitrile build, we get:

$ nitrile build
/bin/sh: 1: clm: not found

We have forgotten to add base as a dependency! This is needed to have a working compiler and build tools. Add the dependency to nitrile.yml:

dependencies:
  base: ^1.0.0

Now run:

$ nitrile update
$ nitrile fetch

The first gets the latest package information from the registry. The second satisfies the dependencies and downloads them into nitrile-packages.

Now we can run nitrile build again:

$ nitrile build
Generating code for _system
Compiling app
Generating code for app
Linking app

And run our application:

$ ./bin/app
"Hello world!"
Execution: 0.00  Garbage collection: 0.00  Total: 0.00