feat: expose the program idl as a flake output#22
Draft
0xgleb wants to merge 3 commits into
Draft
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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.
330112a to
8e29b62
Compare
This was referenced Jun 18, 2026
8e29b62 to
db0c2f2
Compare
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.
db0c2f2 to
0817134
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inputand drop the submodule. The pinned revision moves from a gitlink to the
consumer's
flake.lock.The derivation runs
anchor idl buildwith the host toolchain only -- nocargo-build-sbf, no platform-tools -- so unlike the SBF build it works onevery system, not just aarch64-darwin. Two PATH shims (a
cargowrapper thatstrips the rustup-style
+toolchainargument and a no-oprustup) bridgeanchor's rustup assumptions to the nix toolchain, and the underlying
cargo testis restricted to--libbecause the litesvm integration testsinclude_bytes!the SBF artifact this derivation deliberately does not build.Testing
nix build .#idlproduces a complete IDL (program address,create_fund+depositinstructions, full error enum) -- richer than the staletarget/idl/fund.jsonfrom the last manualanchor build.checks, sonix flake checkbuilds it.