Installation

Nix

The flake builds two packages:

Package Binary Purpose
tern-core (default) tern-core Headless engine
tern tern Engine plus the TUI profile manager

In a project

Projects take tern as a flake input and put it in a development shell next to the tools their templates call. The input only supplies the binary; templates are pinned separately in .tern/config.toml:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    tern.url = "git+https://git.yhkze.net/tern/tern";
  };

  outputs =
    { nixpkgs, flake-utils, tern, ... }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
      in
      {
        devShells.default = pkgs.mkShell {
          packages = [
            tern.packages.${system}.tern
            pkgs.pandoc
          ];
        };
      }
    );
}

Then run tern inside that shell:

nix develop path:. --command tern

A project that already has a default shell for its own code gives tern a separate devShells.docs, so each shell stays light, and runs nix develop path:.#docs --command tern. A flake that consumes such a project sets inputs.<project>.inputs.tern.follows = "tern" to avoid a second copy of tern in its lock file.

Without a project

Build or run either binary straight from the repository:

nix run git+https://git.yhkze.net/tern/tern#tern
nix build git+https://git.yhkze.net/tern/tern#tern-core

Binary cache

Every release is pushed to the yuuhikaze Cachix cache, so the builds above download instead of compiling. Add it to nix.conf:

extra-substituters = https://yuuhikaze.cachix.org
extra-trusted-public-keys = yuuhikaze.cachix.org-1:AtGF4hsoNZahll0Ew3U8fH1CpzKl+OJFPM1tw9qNsYo=

Reference https://docs.cachix.org for other ways to enable a cache.

Cargo

Install both binaries from a checkout:

cargo install --path . --locked

cargo install --path core --locked installs only tern-core.

Building needs:

nix develop in the repository provides all of them.