API for Sigil
  • Zig 99.7%
  • Nix 0.3%
Find a file
2026-09-01 12:15:49 -07:00
lib fix: hold the read deadline on a machine with no spare task 2026-09-01 12:15:49 -07:00
.envrc feat: add the protocol contract and the nix module 2026-08-31 23:25:58 -07:00
.gitignore feat: add the protocol contract and the nix module 2026-08-31 23:25:58 -07:00
build.zig feat: add the protocol contract and the nix module 2026-08-31 23:25:58 -07:00
build.zig.zon feat: add the protocol contract and the nix module 2026-08-31 23:25:58 -07:00
flake.lock feat: add the protocol contract and the nix module 2026-08-31 23:25:58 -07:00
flake.nix feat: add the protocol contract and the nix module 2026-08-31 23:25:58 -07:00
LICENSE Initial commit 2026-08-31 23:23:24 +00:00
README.md feat: add the protocol contract and the nix module 2026-08-31 23:25:58 -07:00
treefmt.nix feat: add the protocol contract and the nix module 2026-08-31 23:25:58 -07:00

sigil-api

The protocol contract of Sigil.

Sigil deploys a static site from a Nix flake. It publishes the site as a Nostr nsite. The files are content addressed blobs on Blossom servers, and the manifest is a signed Nostr event. This package holds the code that reads and writes those formats.

zig build exposes two modules. They are named sigil and sigil-nix.

The sigil module

The protocol contract. Root lib/sigil.zig.

  • crypto, the Schnorr signatures, NIP-44, bech32, base36, and UUID
  • nostr, the events, the relay messages, and the relay client
  • net, the WebSocket client
  • signer, the memory signer and the NIP-46 remote signer
  • manifest, the nsite manifest
  • blossom, the Blossom client and the BUD-11 authorization event
  • config, the configuration document
  • forge, the forge list
  • diagnostic, the report that states what happened, why, and what to do next

The sigil-nix module

The nix command line path. Root lib/sigil-nix.zig.

The module turns a flake reference into a store path. It starts the nix program as a child process, and it links nothing. Two packages use it. The sigil command line program uses it for a local flake build, and the Sigil service uses it for the fallback of SIGIL.md section 5.1. A shared package holds what both sides share.

Zero dependencies

build.zig.zon names no dependency. Each module uses the Zig standard library and nothing else. Neither one links a C library, so zig build alone builds them for any target.

That rule is the reason that the sigil command line program stays statically linked. Do not add a dependency here. Code that needs one belongs in the package that needs it.

sigil-eval is one such case. It uses the fix evaluator, which links libcurl and libgit2. That module stays in the Sigil service repository, and it must not come here.

Use

Add this package to build.zig.zon, then read the modules in build.zig:

const sigil_api = b.dependency("sigil_api", .{ .target = target, .optimize = optimize });
const sigil_mod = sigil_api.module("sigil");
const nix_mod = sigil_api.module("sigil-nix");

License

Apache License 2.0. Read LICENSE.