Skip to content

Nemo client

Markus Krötzsch edited this page Jul 10, 2023 · 4 revisions

The simplest and most direct way of using Nemo is its command-line client, which is called nmo.

Installation

Archives with pre-compiled binaries for various platforms are available from the Nemo releases page. To build your own version from source, you need to have an up-to-date installation of Rust. Moreover, Nemo requires the following dependency on Linux/Unix systems:

  • OpenSSL development packages (e.g., libssl-dev on Ubuntu or openssl-devel on Fedora)

Download the source code (from a release or this repository) and run

cargo build -r

This will create the command-line client nmo in the directory ./target/release/.

Usage

Run the following command for an overview of current options:

nmo --help

The most basic way of running nmo is to pass it a single file that contains a logic program in the Nemo rule language. You can either write your own test files along the documentation in that page, or use some existing example or benchmark.

Nix flake

Nemo is also available as a package for the nix package manager. This allows several different ways of using it. For example, you can directly run Nemo without installing it:

nix run github:knowsys/nemo

Instead of running it directly, you can also just start a shell that has nmo in its path (again without installing it):

nix shell github:knowsys/nemo

The nix flake also provides several other outputs, among it a package allowing you to add Nemo to, e.g., a system configuration or a home-manager. First, add Nemo a as a flake input:

{
  inputs = {
    nixpkgs.url = "…";
    nemo = {
      url = "github:knowsys/nemo";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
}

Then, you can, e.g., add Nemo to a system configuration to have it installed permanently, where system is the appropriate system type, e.g., x86_64-linux.

environment.systemPackages = [ nemo.packages."system".nemo ];

There is also an overlay that can be applied to a nixpkgs instance:

  nixpkgs.overlays = [ nemo.overlays.default ];
  environment.systemPackages = [ pkgs.nemo ];

We also provide the Python and Javascript bindings as flake outputs (packages.*.nemo-python, packages.*.nemo-wasm). There are even pypthon and nodejs packages that have the respective bindings available, so you can, e.g., run a python interpreter with Nemo bindings by executing

nix run github:knowsys/nemo#python3

and, similarly, a nodejs interpreter with Nemo bindings by executing

nix run github:knowsys/nemo#nodejs.

As with the main Nemo package, you can also start a shell with these interpreters in the path or add them to, e.g., a system configuration.

Lastly, for development on Nemo, the flake provides a devShell that has an appropriate rust toolchain and rust-analyzer in its path. From the source directory, run:

nix develop

Clone this wiki locally