A standalone package manager for Nyra — written entirely in Nyra, like cargo is for Rust.
Repository: github.com/nyra-lang/pkg
Provides project management commands (init / add / install / verify) and dedicated toolchain commands (version, bootstrap, updating nyrapkg or Nyra).
Note:
nyra pkg init|add|install|verifywere removed from the official CLI; usenyrapkgfor package management.nyra pkgstill provides onlybuild,bind,c, andprune.
nyrapkg uses the same default Nyra layout:
~/.nyra/
├── bin/
│ ├── nyra # language compiler (from nyra-lang/nyra)
│ └── nyrapkg # package manager (from nyra-lang/pkg)
├── config # registry=…
└── lib/ # LLVM / WASI (optional)
curl -fsSL https://raw.githubusercontent.com/nyra-lang/pkg/main/scripts/install.sh | shRelease tip: GitHub’s
latestAPI ignores pre-releases. Either uncheck “pre-release” when publishing, pin a tag (| sh -s -- --version 0.1.0), or use aninstall.shthat falls back to the newest release (included in this repo).
export NYRA_HOME=/path/to/nyra
cd /path/to/pkg
make dist # → dist/nyrapkg-<arch>-<os>.tar.gz (for GitHub Releases)
# or manually:
nyra build --release -o nyrapkg .
nyrapkg bootstrap # copies the binary to ~/.nyra/bin/nyrapkg
export PATH="$HOME/.nyra/bin:$PATH"curl -fsSL https://raw.githubusercontent.com/nyra-lang/nyra/main/scripts/install.sh | sh
# or via nyrapkg after installing it:
nyrapkg toolchain updateAdd to your shell:
export NYRA_HOME="$HOME/.nyra"
export PATH="$NYRA_HOME/bin:$PATH"| Requirement | Description |
|---|---|
| Nyra | Latest version of the compiler (preferably built from nyra source) |
NYRA_HOME |
Points to the installation/source directory of Nyra (stdlib + example packages) |
git |
Optional — to fetch packages from Git repositories if no local copy is available |
| Network | Optional — for the registry over HTTP (defaults to 127.0.0.1:9470) |
export NYRA_HOME=/path/to/nyra
cd /path/to/pkg
nyra build --release -o nyrapkg .
# Output: ./target/release/nyrapkgexport PATH="$HOME/.nyra/bin:$PATH"
export NYRA_HOME=/path/to/nyra # or ~/.nyra after installation
nyrapkg --version
nyrapkg init
nyrapkg add ny-sqlite ^0.1.0
nyrapkg install ny-serde
nyrapkg verify .Development without installing:
NYRA_HOME=/path/to/nyra nyra run . -- version| Command | Description |
|---|---|
nyrapkg --version / nyrapkg version |
nyrapkg version + nyra version if available |
nyrapkg which |
Paths for NYRA_HOME, bin/, config, and binaries |
nyrapkg bootstrap |
Copy the current binary to ~/.nyra/bin/nyrapkg |
nyrapkg self update [ver] |
Update nyrapkg from releases |
nyrapkg toolchain update [ver] |
Update Nyra in ~/.nyra |
nyrapkg update nyra [ver] |
Alias for toolchain update |
nyrapkg update self [ver] |
Alias for self update |
nyrapkg help |
Command list |
nyrapkg --version
nyrapkg which
nyrapkg self update # latest release
nyrapkg self update 0.1.0 # specific version
nyrapkg toolchain update # latest nyra
nyrapkg update nyra 1.38.0Creates a new Nyra package project.
nyrapkg init # in the current directory
nyrapkg init ./my-app # in a specified directoryCreates:
| File | Content |
|---|---|
nyra.mod |
module example.local |
main.ny |
Simple Hello World program |
nyra.lock |
Empty lock: {"require":[]} |
nyra.sum |
Checksums file (initially empty) |
Adds a require line to nyra.mod, fetches the package, and updates nyra.lock and nyra.sum.
nyrapkg add ny-sqlite
nyrapkg add ny-serde ^0.1.0
nyrapkg add ny-toml ~0.1.0
nyrapkg add my-pkg@1.2.3 # @ form in a single argument
nyrapkg add "my-pkg >=1.0.0" # space inside the argumentVersion spec formats:
| Format | Example |
|---|---|
| Two args | add ny-serde ^0.1.0 |
@ |
add ny-serde@^0.1.0 |
| Space | add "ny-serde ^0.1.0" |
| No spec | add ny-sqlite (any known version / from registry) |
Exactly like add: adds the dependency if missing, fetches the package, and rebuilds lock files.
nyrapkg install ny-sqlite
nyrapkg install ny-serde ^0.1.0Checks project consistency:
- Every
requireinnyra.modhas a matching entry innyra.lock - The version locked in nyra.lock fulfills the semver constraint in
nyra.mod - The lines in
nyra.summatch the registered checksums
nyrapkg verify .
nyrapkg verify /path/to/projectExits with code 0 on success, 1 on failure.
The manifest file (read and written by manifest.ny):
module my.app
version 0.1.0
require ny-sqlite ^0.1.0
require ny-serde ~0.1.0| Line | Meaning |
|---|---|
module |
Module name (like example.local) |
version |
Project version (optional) |
require |
Package name + optional semver spec |
A JSON lock file that fixes versions, sources, and checksums:
{
"version": 1,
"module": "example.local",
"require": [
{
"module": "ny-sqlite",
"version": "0.1.0",
"source": {"kind": "local"},
"checksum": "abc123..."
}
]
}source.kind:localorgit(withurlandrev)- Built automatically by
Cmd_sync_lockafter eachadd/install/init
One line per package: checksum package-name
a1b2c3... ny-sqlite
d4e5f6... ny-serde
Used by verify to check that the cache content wasn't manually altered.
.nyra/cache/
└── ny-sqlite/ # or ny-serde, ny-toml, etc.
├── nyra.mod
└── ...
- Path is derived from the package name (
ny-sqlite→.nyra/cache/ny-sqlite) - Dots in names become
/(for nested packages in the future)
When NYRA_HOME is set to a Nyra source directory, these packages are copied locally from examples/packages/:
| Package | Version | Path under NYRA_HOME |
|---|---|---|
ny-sqlite |
0.1.0 |
examples/packages/ny-sqlite |
ny-serde |
0.1.0 |
examples/packages/ny-serde (stdlib JSON shim) |
ny-toml |
0.1.0 |
examples/packages/ny-toml |
export NYRA_HOME=/path/to/nyra
nyrapkg install ny-sqliteWithout NYRA_HOME you will see: unknown package 'ny-sqlite'.
- Default:
http://127.0.0.1:9470 - Customization:
~/.nyra/configfile:
registry=https://registry.example.comThe registry provides JSON/JSONL indexes at /index/<package>. If a version is found online, it will be used instead of the local one.
semver.ny supports common constraints:
| Constraint | Meaning |
|---|---|
1.2.3 |
Exact version |
^0.1.0 |
Compatible with 0.1.x |
~0.1.0 |
Approximately 0.1.x |
>=1.0.0 |
Greater or equal |
Resolution order in fetch.ny:
- Local cache — if
nyra.modis found at.nyra/cache/<pkg>, re-fetch is skipped - Direct URL —
https://...orgit@...are treated as Git repositories - Registry HTTP — best version matching the constraint
- Known local packages — via
NYRA_HOME - Git — tarball from GitHub, or
git cloneas fallback
nyrapkg/
├── main.ny # Entry point — argv() → Cmd_dispatch
├── nyra.mod
├── nyra.lock
├── nyra.sum
├── README.md
├── src/
│ ├── commands.ny # CLI commands: init, add, install, verify
│ ├── manifest.ny # Read/write nyra.mod
│ ├── lockfile.ny # nyra.lock + nyra.sum (JSON via stdlib/json)
│ ├── fetch.ny # Local copy, git, tarball
│ ├── registry.ny # HTTP registry + built-ins
│ ├── semver.ny # Version parsing & comparison
│ └── paths.ny # .nyra/cache paths
└── tests/
├── semver_test.ny
└── lockfile_test.ny
export NYRA_HOME=/path/to/nyra
# Type checking
nyra check .
# Unit tests
nyra test .
# Build release
nyra build --release .export NYRA_HOME=/path/to/nyra
BIN=./target/release/main
rm -rf /tmp/demo && mkdir /tmp/demo && cd /tmp/demo
$BIN init .
$BIN install ny-sqlite
$BIN add ny-serde "^0.1.0"
$BIN verify .
cat nyra.mod
cat nyra.locknyrapkg (this project) |
nyra pkg (official CLI) |
|
|---|---|---|
| Language | Entirely Nyra | Rust (cli/src/commands/pkg.rs) |
| Extra features | — | publish, login, bind c, prune, … |
| Goal | Prove language capability + extensible pkg | Official production tool |
For daily use in regular Nyra projects, nyra pkg init and nyra pkg install remain the official way. nyrapkg is a complementary and independent tool for experimentation and development.
| Issue | Solution |
|---|---|
unknown package '…' |
Set NYRA_HOME or run a local registry |
missing lock entry |
Run install or add to rebuild the lock |
checksum mismatch |
Delete .nyra/cache/<pkg> and re-run install |
| Build failed | Make sure you have a recent Nyra version (fixes for strcat, strcmp, JSON) |
Follows the license of the parent Nyra project unless otherwise stated in this repository.