Package Management

Nitto comes with an buildin package management solution.

Repositories

A nitto package repository is a place where nitto can get packages from. A package is essentially just a non-local target, but it still carries the same data as a real one: namely the data in it’s datastore and the files on the disk.

In nitto we have two kinds of package repositories:

  • a source repo, which is a git repository with a bunch of nittofiles
  • a binary repo, which is an webserver serving archives of artifacts

Each repo can be both at the same time; nitto first tries to find any given dependency in the binary repo (if configured) and then tries to build it from scratch using the source repo (if configured).

adding repositories

To add a repository you have two possibilities: user repos and file-local repos. Both of them have their strengths:

  • user repositories are good for publishing artifacts since they are available in every project
  • file-local repositories are neccessary for dependencies since they provide the data where to get them from

Example:

package add_repo myrepo {
    src "https://github.com/xxx/yyy"
    bin "https://packages.mydomain.tld/zzz"
}

Using a package

Nittos package management system provides an new accessor:

package://<repo>/<package>@<version>

Just use it how any other accessor with the use command in a target:

target "myapp" {
    # ...

    use "package://myrepo/ruby@3.1.3"
}

Publishing a package

Defining the package

Use package define "name" with an block to define a package. For the command reference, see here.

Example:

package define "ruby" {
    vendor "ruby.org"
    versions [ "3.0.5", "3.1.3" ]
    depData [ "c_cpp.linkName", "c_cpp.linkDir", "c_cpp.pubIncDirs" ]
    target "ruby" {
        set_opt "ruby-version" "$(sys.version)"
    }
}

Publish the package

Use the cli command nitto package publish (or nitto pack pub for short) to publish packages.

Usage:

nitto pack pub [--rebuild,-r] <package> <version> <repository> [<triplet>]

The last argument <triplet> can be ommited; nitto then builds for all triplets possible (see listing available triplets in show project data).