Skip to content

Commit 2e1e61c

Browse files
committed
docs: rewrite README and remove registry references
Rewrote the "Why" section to focus on key differentiators (version pinning, version switching, ephemeral exec). Removed all registry references from README and AGENTS.md since the registry was replaced by aliases.json.
1 parent 5364333 commit 2e1e61c

2 files changed

Lines changed: 20 additions & 31 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Zig 0.15+ required. This is Zig 0.15 which uses newer APIs (`std.Io.Writer.Alloc
1414

1515
## Architecture
1616

17-
Onyx is a package manager with two install paths: **registry packages** (resolved via Onyx registry, fetched from the Nix binary cache) and **third-party packages** (GitHub/domain sources with `onyx.toml` manifests, installed directly).
17+
Onyx is a package manager with two install paths: **Nix packages** (resolved via aliases + Nixhub API, fetched from the Nix binary cache) and **third-party packages** (GitHub/domain sources with `onyx.toml` manifests, installed directly).
1818

1919
### Source files
2020

2121
- **main.zig** — CLI entry point, all command implementations (`cmdInstall`, `cmdExec`, `cmdUninstall`, `cmdUse`, `cmdGc`, `cmdUpgrade`, `cmdInit`, `cmdImplode`)
2222
- **cli.zig** — argument parsing, `PackageRef` (name@version), `Command` union
23-
- **resolver.zig**registry alias resolution, Nixhub API calls, index caching with TTL
23+
- **resolver.zig** — alias resolution, Nixhub API calls, index caching with TTL
2424
- **fetcher.zig** — NAR closure fetching, parallel download (thread pool), hash verification
2525
- **source.zig** — third-party package resolution (GitHub, domain), TOML manifest parsing, meta tag discovery
2626
- **store.zig**`Database` struct: state.json load/save, version management, symlink install/remove
@@ -30,7 +30,7 @@ Onyx is a package manager with two install paths: **registry packages** (resolve
3030

3131
### Two install paths
3232

33-
**Nix path**: `resolveAlias` (registry index) → `resolve` (Nixhub API) → `fetchClosure` (cache.nixos.org, parallel NARs) → unpack to `/nix/store/` → symlink to `~/.local/bin/`
33+
**Nix path**: `resolveAlias` (aliases.json) → `resolve` (Nixhub API) → `fetchClosure` (cache.nixos.org, parallel NARs) → unpack to `/nix/store/` → symlink to `~/.local/bin/`
3434

3535
**Third-party path**: `resolveGithub`/`resolveDomain` → download binary/tarball → install to `/opt/onyx/packages/{name}/{version}/` → symlink to `~/.local/bin/`
3636

@@ -39,7 +39,7 @@ Both paths store state in `~/.local/share/onyx/state.json` and create symlinks i
3939
### Key patterns
4040

4141
- **Locking**: `acquireLock`/`releaseLock` via file lock on `~/.local/share/onyx/lock`. Commands that mutate state (`install`, `uninstall`, `use`, `gc`, `upgrade`) must hold the lock. `cmdInstall` wraps `cmdInstallInner` to avoid recursive lock acquisition when installing dependencies.
42-
- **Alias resolution**: `resolveAlias` checks `~/.cache/onyx/index.json`. Fast commands (`exec`, `use`, `list`) use cached index forever. Slow commands (`install`, `upgrade`) refresh if >1 day old via `resolveAliasFresh`.
42+
- **Alias resolution**: `resolveAlias` checks `~/.cache/onyx/aliases.json`. Fast commands (`exec`, `use`, `list`) use cached aliases forever. Slow commands (`install`, `upgrade`) refresh if >1 day old via `resolveAliasFresh`.
4343
- **Ephemeral packages**: `exec` auto-installs packages marked `ephemeral: true` with `last_used` timestamp. These are hidden from `list` and cleaned by `gc` after 30 days.
4444
- **Symlink ownership**: `removeSymlinks` uses `readLink` to verify the symlink points to `/nix/store/` or `/onyx/packages/` before deleting — never removes files owned by other tools.
4545
- **exec fast path**: `cmdExec` checks state.json first. If the package is already installed, it skips all network calls and directly `execv`s into the binary.

README.md

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Onyx
22

3-
Onyx is a package manager that combines a curated registry with the Nix binary cache. The registry provides name resolution and aliases; the Nix cache provides 80,000+ prebuilt packages. Third-party packages skip Nix entirely — they publish an onyx.toml with download URLs and install directly to `~/.local/bin`.
3+
Onyx is a package manager backed by the Nix binary cache80,000+ prebuilt packages, installed in seconds. Third-party packages skip Nix entirely — they publish an onyx.toml with download URLs and install directly to `~/.local/bin`.
44

55

66
```bash
@@ -15,18 +15,15 @@ onyx x ruby -- script.rb
1515

1616
## Why
1717

18-
| | Onyx | Homebrew | Nix | apt |
19-
|---|---|---|---|---|
20-
| Install speed | Seconds (prebuilt) | Minutes (often builds) | Seconds | Seconds |
21-
| Packages | 80,000+ | ~7,000 | 80,000+ | Distro-dependent |
22-
| Multi-version | `onyx use node@20` | No | Manual | No |
23-
| Cross-platform | Linux + macOS | macOS-first | Linux + macOS | Linux only |
24-
| Binary size | <1MB | 12MB+ Ruby runtime | 30MB+ | System package |
25-
| Deterministic | Yes (content-addressed) | No | Yes | No |
18+
Nix has the best package infrastructure ever built — 80,000+ prebuilt packages in a content-addressed binary cache.
2619

27-
Onyx takes the best of each world:
28-
- **Nix's binary cache** — 80k+ packages, content-addressed, reproducible
29-
- **None of the complexity** — no Ruby, no Nix language, no learning curve
20+
Onyx gives you the cache without the overhead. One static binary under 1 MB, no configuration, no new language to learn.
21+
22+
- **Version pinning**`onyx install node@20` and `node@22` live side by side, each install is atomic
23+
- **Version switching**`onyx use node@20` flips the active version instantly
24+
- **Run without installing**`onyx x jq -- '.name' package.json` fetches and runs, `onyx gc` cleans up after 30 days
25+
- **Cross-platform** — same tool, same packages on Linux and macOS
26+
- **Extensible** — third-party packages via simple TOML manifests, no Nix expressions needed
3027

3128
## Quickstart
3229

@@ -78,22 +75,14 @@ Third-party packages (`user:repo`, `domain.com`) skip the nix store entirely and
7875

7976
```mermaid
8077
flowchart LR
81-
A[onyx install nodejs@22] --> B
82-
83-
subgraph B[Registry]
84-
direction TB
85-
B1[Resolve alias] --> B2{Onyx package?}
86-
end
87-
88-
B2 -->|yes| D[Install to ~/.local/share/onyx/]
89-
B2 -->|no| C[Nixhub API]
90-
C --> E[cache.nixos.org]
91-
E --> F[Install to /nix/store/]
92-
D -->|symlink| G[~/.local/bin/]
93-
F -->|symlink| G
78+
A[onyx install nodejs@22] --> B[Resolve alias]
79+
B --> C[Nixhub API]
80+
C --> D[cache.nixos.org]
81+
D --> E[Install to /nix/store/]
82+
E -->|symlink| F[~/.local/bin/]
9483
```
9584

96-
The [Onyx registry](https://github.com/lilienblum/onyx/tree/registry/v0) is checked first. If it has a direct package definition, the binary is downloaded and installed. Otherwise, the name is resolved through the Nix path — Nixhub API, dependency closure from `cache.nixos.org`, parallel download, unpack, and symlink into `~/.local/bin/`.
85+
Aliases (`node``nodejs`) are resolved first, then the Nixhub API finds the package, its dependency closure is fetched in parallel from `cache.nixos.org`, unpacked to `/nix/store/`, and symlinked into `~/.local/bin/`.
9786

9887
Third-party packages (`user:repo`, `domain.com`) fetch an `onyx.toml` manifest, download the binary for your platform, verify SHA256, and install directly — no nix store involved.
9988

@@ -124,7 +113,7 @@ Aliases: `i` install, `rm` uninstall, `x` exec, `ls` list.
124113
/opt/onyx/packages/my-tool/ third-party packages
125114
126115
~/.local/share/onyx/state.json package state
127-
~/.cache/onyx/index.json registry index
116+
~/.cache/onyx/aliases.json alias cache
128117
```
129118

130119
## Third-party packages

0 commit comments

Comments
 (0)