Write a pkg.yaml
A package is a single pkg.yaml manifest stored at pkgs/<name>/pkg.yaml
inside a catalog. It tells nem how to fetch, verify, install, and test a tool.
Here’s a complete manifest for jq:
schemaVersion: 1
name: jq
description: Command-line JSON processor
homepage: https://jqlang.github.io/jq/
license: MIT
archive:
fetch:
github_release:
repo: jqlang/jq
assetName: "jq-{{.OS}}-{{.Arch}}"
templateOverrides:
darwin: macos
releaseFilter: '^jq-(\d+\.\d+\.\d+)$'
versionTemplate: "v{{.Capture}}"
releaseTemplate: 'jq-{{.Version | trimPrefix "v"}}'
verify:
checksumGitHubAsset: "sha256sum.txt" # algorithm: sha256 by default
install:
- copy:
from: "{{.Archive}}"
to: "{{.InstallDir}}/bin/jq"
test:
- run:
cmd: ["{{.InstallDir}}/bin/jq", "--version"]The top-level blocks:
- Metadata —
schemaVersion,name,description,homepage,license. archive— how tofetchthe artifact andverifyits checksum. This one uses thegithub_releasefetcher;nemalso supportsgithub_tag,http, andoci.install— an ordered list of steps (copy,extract,run, …) that place files under{{.InstallDir}}.test— optional commands run after install to confirm it worked.
Strings are Go templates with variables like {{.OS}}, {{.Arch}},
{{.Version}}, {{.Archive}}, and {{.InstallDir}}, plus helpers such as
trimPrefix.
The pkg.yaml schema reference documents every field, fetch block, verify mode, install step, and template variable. When you’re done, validate it.