Skip to content

feat: expose the program idl as a flake output#22

Draft
0xgleb wants to merge 3 commits into
masterfrom
feat/idl-flake-output
Draft

feat: expose the program idl as a flake output#22
0xgleb wants to merge 3 commits into
masterfrom
feat/idl-flake-output

Conversation

@0xgleb

@0xgleb 0xgleb commented Jun 10, 2026

Copy link
Copy Markdown
Member

🦋 GitButler workspace — open PRs in data-cartel/fund


Motivation

moneymentum needs the program's Anchor IDL to generate client bindings, and a
git submodule was the only way to reach it. Submodules bring gitlink/checkout
friction everywhere they touch (CI, worktrees, fresh clones); all the consumer
actually needs is one build artifact.

Solution

Expose the IDL as a flake output: packages.idl (also the default package)
builds idl/fund.json, so moneymentum can take fund as a regular flake input
and drop the submodule. The pinned revision moves from a gitlink to the
consumer's flake.lock.

The derivation runs anchor idl build with the host toolchain only -- no
cargo-build-sbf, no platform-tools -- so unlike the SBF build it works on
every system, not just aarch64-darwin. Two PATH shims (a cargo wrapper that
strips the rustup-style +toolchain argument and a no-op rustup) bridge
anchor's rustup assumptions to the nix toolchain, and the underlying
cargo test is restricted to --lib because the litesvm integration tests
include_bytes! the SBF artifact this derivation deliberately does not build.

Testing

  • nix build .#idl produces a complete IDL (program address, create_fund +
    deposit instructions, full error enum) -- richer than the stale
    target/idl/fund.json from the last manual anchor build.
  • The derivation is also wired into checks, so nix flake check builds it.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0e7cf4c0-a179-4c0a-ac24-d4efa9871416

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/idl-flake-output

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@0xgleb 0xgleb self-assigned this Jun 10, 2026
0xgleb added a commit to dataclique/moneymentum that referenced this pull request Jun 10, 2026
moneymentum needs the fund program's Anchor IDL to generate client
bindings. A git submodule was the first attempt, but gitlinks bring
checkout/CI/worktree friction everywhere they touch, and all we consume
is one build artifact.

Take fund as a regular flake input instead: its packages.idl output
builds the IDL with the host toolchain, the pinned revision lives in
flake.lock (nix flake update fund replaces git submodule update), and
the dev shell exposes FUND_IDL pointing at the built idl/fund.json for
anchor-lang's declare_program! to consume at compile time.

The input is pinned to the feat/idl-flake-output head until
dataclique/fund#22 merges, then it can track the default branch.
0xgleb added a commit to dataclique/moneymentum that referenced this pull request Jun 10, 2026
moneymentum needs the fund program's Anchor IDL to generate client
bindings. A git submodule was the first attempt, but gitlinks bring
checkout/CI/worktree friction everywhere they touch, and all we consume
is one build artifact.

Take fund as a regular flake input instead: its packages.idl output
builds the IDL with the host toolchain, the pinned revision lives in
flake.lock (nix flake update fund replaces git submodule update), and
the dev shell exposes FUND_IDL pointing at the built idl/fund.json for
anchor-lang's declare_program! to consume at compile time.

The input is pinned to the feat/idl-flake-output head until
dataclique/fund#22 merges, then it can track the default branch.
0xgleb added a commit to dataclique/moneymentum that referenced this pull request Jun 10, 2026
moneymentum needs the fund program's Anchor IDL to generate client
bindings. A git submodule was the first attempt, but gitlinks bring
checkout/CI/worktree friction everywhere they touch, and all we consume
is one build artifact.

Take fund as a regular flake input instead: its packages.idl output
builds the IDL with the host toolchain, the pinned revision lives in
flake.lock (nix flake update fund replaces git submodule update), and
the dev shell exposes FUND_IDL pointing at the built idl/fund.json for
anchor-lang's declare_program! to consume at compile time.

The input is pinned to the feat/idl-flake-output head until
dataclique/fund#22 merges, then it can track the default branch.
0xgleb added a commit to dataclique/moneymentum that referenced this pull request Jun 13, 2026
moneymentum needs the fund program's Anchor IDL to generate client
bindings. A git submodule was the first attempt, but gitlinks bring
checkout/CI/worktree friction everywhere they touch, and all we consume
is one build artifact.

Take fund as a regular flake input instead: its packages.idl output
builds the IDL with the host toolchain, the pinned revision lives in
flake.lock (nix flake update fund replaces git submodule update), and
the dev shell exposes FUND_IDL pointing at the built idl/fund.json for
anchor-lang's declare_program! to consume at compile time.

The input is pinned to the feat/idl-flake-output head until
dataclique/fund#22 merges, then it can track the default branch.
@0xgleb 0xgleb force-pushed the feat/idl-flake-output branch 3 times, most recently from 330112a to 8e29b62 Compare June 17, 2026 05:08
@0xgleb 0xgleb force-pushed the feat/idl-flake-output branch from 8e29b62 to db0c2f2 Compare June 19, 2026 01:03
Consumers (moneymentum) need the anchor idl json to generate client
bindings, and a git submodule was the only way to get it. Build the idl
as a nix derivation (packages.idl, also the default package) so fund can
be consumed as a regular flake input instead.

The derivation runs anchor idl build with the host toolchain only -- no
cargo-build-sbf, no platform-tools -- so it evaluates on every system,
not just aarch64-darwin. Two PATH shims (cargo +toolchain arg stripper,
no-op rustup) bridge anchor's rustup-style invocations to the nix
toolchain, and the underlying cargo test is restricted to --lib because
the litesvm integration tests include_bytes! the sbf artifact this
derivation deliberately does not build.
@0xgleb 0xgleb force-pushed the feat/idl-flake-output branch from db0c2f2 to 0817134 Compare June 27, 2026 21:30
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.

1 participant