Skip to content

Nix recipe artifacts: kind tag and resolve --release (refs #18) - #19

Draft
imattau wants to merge 5 commits into
masterfrom
issue-18-nix-recipes
Draft

imattau wants to merge 5 commits into
masterfrom
issue-18-nix-recipes

Conversation

@imattau

@imattau imattau commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Refs #18 (does not close it).

Publishing, forking, finding and consuming Nix build recipes as npack artifacts.

Changes

Protocol / core

  • Optional release tag kind (e.g. nix-recipe). Non-package kinds are refused by install/update before downloading, and shown by resolve.
  • Optional fork-of tag (publisher, name, release event ID): provenance only.
  • npack resolve --release <event-id> pins one exact release with the usual signature/trust/revocation/name/os-arch checks.

Authoring and forking

  • npack init --kind nix-recipe defaults os/arch to any and scaffolds a default.nix; --fork-of <publisher>/<name>@<id> records provenance.
  • npack unpack <ref> --output DIR downloads, hash-verifies and extracts a package (also the way to review a recipe's code). With --fork-as <publisher> [--name N] it writes a manifest that inherits kind and records fork_of, so no extra flags are needed to fork.

Discovery

  • npack search --kind <kind>; search and info show [kind] and (fork of ...).

Nix consumer (packaging/nix)

  • lib.nix: fetchRecipe, fromPins, fromPinsWith { pinsFile, trustedPublishers } (evaluation fails for any other publisher). Recipes share one scope, so a declared dependency is a plain function argument.
  • flake.nix (lib and overlay).
  • npack-nix-pin: recursive pinning, a summary of new/changed pins, --check (exit 1 if pins would change), refusal to silently replace a pin with one from another publisher, and a warning when a dependency resolves to a different publisher than its dependent.

Docs: protocol (kind, fork-of), a full publish/fork/use workflow in using-npack.md with a NixOS example and trust notes, and CLAUDE.md.

Agent guide: a canonical AGENTS.md (architecture, release/install flow, code map, how to test end to end with a local relay, gotchas; not Nix-specific). CLAUDE.md now just imports it.

Verified

  • cargo fmt --check, cargo clippy --all-targets, cargo test pass (72 + 3).
  • End to end against a local relay + Blossom (nak serve --blossom), building in a Debian VM with Nix: resolve, resolve --release, search --kind, info, unpack --fork-as then repack and publish of a fork, npack-nix-pin (including --check and the conflict refusal), a recipe with a dependency, and the flake. trustedPublishers rejects an unlisted publisher. A tampered hash is rejected.
  • Finding: a dependency declared without a publisher resolves to whichever publisher has a package of that name (existing npack behaviour). Documented; recipes should declare the dependency's publisher.

Not done

  • Not tested on real NixOS or public relays, or with the issue reporter's recipes.
  • Evaluation uses import-from-derivation, so it is not suitable for nixpkgs/Hydra.
  • The pin tool is a Python script and the Nix files are not shipped in release artifacts; they are consumed via the flake input or copied.
  • Pins carry mirror URLs as published; refresh by rerunning npack-nix-pin.
  • Binary-cache linkage is out of scope.

🤖 Generated with Claude Code

lostcause and others added 2 commits October 18, 2026 09:13
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e 18)

- Optional singleton 'kind' release tag and manifest field; non-package
  kinds are refused by install/update and surfaced in resolve output.
- npack resolve --release <event-id> pins to an exact release event.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
lostcause and others added 3 commits October 18, 2026 09:22
- packaging/nix: lib.nix (fetchRecipe/fromPins with shared scope so declared
  dependencies are plain arguments), flake.nix, npack-nix-pin.
- Optional fork-of release tag (provenance only).
- update/install check kind before downloading.
- Docs: Nix recipes section and trust warning.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…heck, trustedPublishers

- npack unpack [--fork-as] extracts a verified package and scaffolds a fork
  manifest that inherits kind and records fork_of.
- init --kind/--fork-of (nix-recipe scaffolds default.nix, os/arch any).
- search --kind; search/info show kind and fork-of.
- npack-nix-pin: --check, change summary, publisher-conflict refusal,
  cross-publisher dependency warning.
- lib.nix fromPinsWith { trustedPublishers }.
- Docs: end-to-end publish/fork/use workflow, NixOS example, trust notes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Self-contained Nix build recipes as Nostr packages

1 participant