Skip to content

Rename moq binary to moq-cli#1023

Merged
kixelated merged 5 commits intomainfrom
claude/speed-up-cdn-deployments-IccwW
Mar 3, 2026
Merged

Rename moq binary to moq-cli#1023
kixelated merged 5 commits intomainfrom
claude/speed-up-cdn-deployments-IccwW

Conversation

@kixelated
Copy link
Collaborator

Summary

This PR improves the Nix build caching strategy to ensure CDN nodes can download pre-built binaries from Cachix instead of compiling from source. It also clarifies the moq dependency management approach and ensures build consistency across environments.

Key Changes

  • Enhanced Cachix workflow: Modified .github/workflows/cachix.yml to build and cache each package individually (moq-relay, moq-cli, moq-token) rather than building a single workspace. This ensures each package's closure is cached separately, allowing CDN nodes to download pre-built binaries.

  • Consistent frame pointer configuration: Moved frame pointer enablement from cdn/flake.nix (as a local override) to nix/overlay.nix as a standard build flag. This ensures the CDN build matches what Cachix caches and provides profiling support with negligible overhead.

  • Improved moq dependency documentation: Updated comments in cdn/flake.nix to clarify two strategies:

    • Pin to a release tag for versioned, cached deployments
    • Update to latest main for development
    • Removed outdated TODO about cross-compilation
  • Added pin justfile command: New command in cdn/justfile to easily pin moq to a specific release tag for reproducible deployments.

  • Clarified deployment messaging: Updated status messages in cdn/justfile from "Building and caching packages" to "Fetching packages (from Cachix or building)" to better reflect the actual behavior.

Implementation Details

The key insight is that building packages individually in CI ensures their full dependency closures are cached on Cachix. When deployment scripts run nix build on remote nodes, they can download pre-built artifacts instead of compiling, significantly reducing deployment time.

Frame pointers are now consistently enabled in the overlay, ensuring the build artifacts match what's cached, and providing profiling support for production debugging.

https://claude.ai/code/session_01RFDCXbXcRsBWpcxHDoxFBt

claude and others added 2 commits March 1, 2026 05:36
The CDN deploys were slow because `nix build` compiled Rust from scratch
on the remote Linode VMs. The root cause: the CDN flake overrode
moq-relay with custom RUSTFLAGS (frame pointers), creating a different
derivation hash than what Cachix cached, so the cache never hit.

Changes:
- Move frame pointers into the main nix overlay so the CDN build matches
  what Cachix caches (negligible overhead, useful for profiling anywhere)
- Remove the overrideAttrs from cdn/flake.nix so it uses upstream directly
- Build each package explicitly in the Cachix workflow and push closures
- Add `just pin <tag>` for versioned deployments (e.g., just pin moq-relay-v0.10.6)

Deploy workflow becomes: pin to a release tag, then deploy. The remote
downloads pre-built binaries from Cachix instead of compiling.

https://claude.ai/code/session_01RFDCXbXcRsBWpcxHDoxFBt
…eployments-IccwW

# Conflicts:
#	cdn/flake.nix
#	cdn/justfile
@kixelated kixelated marked this pull request as ready for review March 2, 2026 22:19
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f1bd28 and 1c406ec.

📒 Files selected for processing (13)
  • cdn/pub/demo-bbb-prepare.service
  • cdn/pub/demo-bbb.service.tftpl
  • cdn/pub/justfile
  • cdn/pub/main.tf
  • doc/app/cli.md
  • doc/app/index.md
  • doc/rs/crate/hang.md
  • doc/rs/crate/moq-mux.md
  • doc/rs/index.md
  • flake.nix
  • justfile
  • nix/overlay.nix
  • rs/moq-cli/Cargo.toml
💤 Files with no reviewable changes (1)
  • rs/moq-cli/Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (1)
  • nix/overlay.nix

Walkthrough

This pull request changes CI build caching to run three separate nix builds and cachix pushes for moq-relay, moq-cli, and moq-token. It adds RUSTFLAGS = "-C force-frame-pointers=yes" to the moq-relay derivation and renames the exported package attribute from moq to moq-cli across nix flakes and overlays. The CLI binary name and references are updated to moq-cli in documentation and build files; the moq binary target was removed from Cargo.toml. Service and deployment artifacts were renamed from hang-bbb to demo-bbb.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: improving Cachix caching strategy and ensuring build consistency across the codebase.
Description check ✅ Passed The description comprehensively relates to the changeset, explaining the motivation, key changes, and implementation details of the Cachix caching improvements and build consistency updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/speed-up-cdn-deployments-IccwW

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/cachix.yml:
- Around line 35-38: The workflow builds the wrong flake output name (it uses
.#moq-cli), causing the nix build to fail because the flake exports the package
as moq; update the GitHub Actions step that runs nix build to use .#moq instead
of .#moq-cli (keep the --print-build-logs flag and subsequent cachix push
./result unchanged) so the build references the correct flake output.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e4e77b and 4f1bd28.

📒 Files selected for processing (2)
  • .github/workflows/cachix.yml
  • nix/overlay.nix

Comment on lines +35 to +38
- name: Build and cache moq-cli
run: |
nix build .#moq-cli --print-build-logs
cachix push kixelated ./result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Workflow targets =="
rg -n -C2 'nix build \.#' .github/workflows/cachix.yml

echo
echo "== Overlay package attrs =="
rg -n -C3 '^\s*(moq-relay|moq-token|moq)\s*=' nix/overlay.nix

echo
echo "== Flake package/app output mappings (all flake.nix files) =="
fd -H '^flake\.nix$' | while read -r f; do
  echo "--- $f ---"
  rg -n -C4 '\b(packages|legacyPackages|apps)\b|moq-cli|moq-token|moq-relay|\bmoq\b' "$f" || true
done

Repository: moq-dev/moq

Length of output: 3817


Fix the flake output name: change .#moq-cli to .#moq

Line 37 builds .#moq-cli, but the root flake.nix only exports the package as moq (not moq-cli). While nix/overlay.nix defines the derivation for the CLI tool, it's named moq, and the flake outputs inherit it with that same name. This step will fail at build time. Change to nix build .#moq --print-build-logs.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/cachix.yml around lines 35 - 38, The workflow builds the
wrong flake output name (it uses .#moq-cli), causing the nix build to fail
because the flake exports the package as moq; update the GitHub Actions step
that runs nix build to use .#moq instead of .#moq-cli (keep the
--print-build-logs flag and subsequent cachix push ./result unchanged) so the
build references the correct flake output.

@kixelated kixelated changed the title Improve Cachix caching strategy and build consistency Rename moq binary to moq-cli Mar 3, 2026
@kixelated kixelated enabled auto-merge (squash) March 3, 2026 03:43
@kixelated kixelated merged commit 286fb19 into main Mar 3, 2026
1 check passed
@kixelated kixelated deleted the claude/speed-up-cdn-deployments-IccwW branch March 3, 2026 03:58
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.

2 participants