Skip to content

Replace template CI with Nix-based setup#30

Open
kixelated wants to merge 5 commits intomainfrom
improve-ci
Open

Replace template CI with Nix-based setup#30
kixelated wants to merge 5 commits intomainfrom
improve-ci

Conversation

@kixelated
Copy link
Copy Markdown
Collaborator

Summary

  • Delete ~2800 lines of OBS plugin template CI (zsh/pwsh scripts, 6 composite actions, complex workflows)
  • Add Nix flake for deterministic deps (clang-format, gersemi, cmake, ninja, ffmpeg, obs-studio)
  • Simplify justfile: just check/just fix call tools directly, no more build-aux/ scripts
  • Two minimal workflows: PR lint+build, push lint+build+release
  • Tag-triggered release automation with artifact uploads

What changed

  • flake.nix — devShell with all build and lint deps, pinned via flake.lock
  • justfilecheck/fix inline clang-format and gersemi calls, added ci recipe
  • .github/workflows/ — two simple workflows using cachix/install-nix-action + just
  • cmake/macos/buildspec.cmake — xattr no longer fatal (was failing on build-generated files)
  • Source files — reformatted with clang-format 21.x (was pinned to 19.1.1)

Fixes

  • FFmpeg not found in CI (now provided by Nix)
  • clang-format version pin breaking local dev
  • xattr permission errors in macOS CMake configure

Test plan

  • nix develop -c just check passes locally
  • nix develop -c just setup && nix develop -c just build passes locally (macOS verified)
  • CI lint job passes (Linux)
  • CI build jobs pass (Linux, macOS)
  • Windows CI build (may need iteration on FFmpeg/just installation)

🤖 Generated with Claude Code

Delete the OBS plugin template CI infrastructure (~2800 lines of zsh/pwsh
scripts, 6 composite actions, 3 complex workflows) and replace with:

- Nix flake providing deterministic deps (clang-format, gersemi, cmake,
  ninja, pkg-config, ffmpeg, obs-studio on Linux)
- Simple justfile recipes for check/fix/build (no more build-aux scripts)
- Two minimal GitHub workflows: PR checks + push/release
- Tag-triggered release automation with artifact uploads

Also fixes:
- FFmpeg not found in CI (now provided by Nix)
- clang-format version pin breaking local dev (no longer pinned to 19.1.1)
- xattr permission errors in macOS buildspec.cmake

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e3eafe78-de2d-4934-bd55-8fa6484e69df

📥 Commits

Reviewing files that changed from the base of the PR and between c248c21 and 1d5cab5.

📒 Files selected for processing (2)
  • .github/workflows/pr-pull.yaml
  • .github/workflows/push.yaml

Walkthrough

This pull request removes a large collection of CI and build helper files (multiple GitHub Actions workflows and composite actions, many scripts under .github/scripts, build-aux helper functions, and assorted logging/utilities). It adds a Nix flake (flake.nix) and a .envrc directive to use that flake, updates the justfile to run formatting and CI tasks with direct tools (clang-format, gersemi) and adds a ci task, and includes small source reformatting edits and a minor CMake tweak.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Replace template CI with Nix-based setup' directly and clearly summarizes the main change: replacing the existing template CI infrastructure with a Nix-based approach.
Description check ✅ Passed The description is comprehensive and related to the changeset, detailing what was deleted, what was added, which problems are being fixed, and providing a test plan.
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
  • Commit unit tests in branch improve-ci
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch improve-ci

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.

kixelated and others added 2 commits April 1, 2026 14:17
Copy link
Copy Markdown

@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: 4

🤖 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/pr-pull.yaml:
- Around line 37-47: The Windows job build-windows is failing because the runner
lacks the just binary and the run steps default to PowerShell while the justfile
expects bash; fix by installing just (e.g., via choco or scoop) before invoking
it and ensure the just commands run under a bash shell by adding shell: bash to
the steps that call just (or run a bash environment), e.g., install just in a
pre-step and change the Setup and Build steps that call just setup and just
build to use shell: bash so the justfile shebang is honored.

In @.github/workflows/push.yaml:
- Around line 46-61: In the build-windows job update the steps that run "just"
so they first install the just binary and run under a bash shell: add a step
before the "Setup" step to install just (e.g., run: choco install just -y) and
add shell: bash to the steps that currently say run: just setup and run: just
build so those commands execute in a POSIX shell where just is available.

In `@flake.nix`:
- Around line 36-43: libDeps includes obs-studio only on Linux so macOS CI fails
because find_package(libobs REQUIRED) in CMake when BUILD_PLUGIN is enabled
cannot find OBS; fix by either (A) updating the macOS CI step that runs "nix
develop --command just setup" on macos-15 to install OBS beforehand (e.g., use
Homebrew to install or cask install obs) or (B) change CI to disable
BUILD_PLUGIN on Darwin (set BUILD_PLUGIN=OFF or similar env flag) and add a
clear note in documentation/README that macOS builds require OBS pre-installed
externally since obs-studio is not available in nixpkgs; reference libDeps,
obs-studio, BUILD_PLUGIN and find_package(libobs REQUIRED) when making the
change.

In `@justfile`:
- Around line 17-24: The check recipe in the justfile only runs gersemi on the
root CMakeLists.txt (the check target and the gersemi invocation), so
subdirectory .cmake files with gersemi directives are not validated; update the
gersemi invocation in the check target to include all CMake files (e.g. keep
CMakeLists.txt and add a glob like cmake/**/*.cmake or other project-wide
pattern) so gersemi validates all cmake/** files, and also reconcile the
documentation vs. implementation by either adding the build-aux/run-gersemi
script referenced in CLAUDE.md or updating CLAUDE.md to reflect the actual
command used in the check target (reference: justfile::check and the gersemi
command).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ca312cfa-224c-4843-bed7-7c4394d00dfa

📥 Commits

Reviewing files that changed from the base of the PR and between 8776f8e and 421f4f6.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (55)
  • .envrc
  • .github/actions/build-plugin/action.yaml
  • .github/actions/check-changes/action.yaml
  • .github/actions/package-plugin/action.yaml
  • .github/actions/run-clang-format/action.yaml
  • .github/actions/run-gersemi/action.yaml
  • .github/actions/setup-macos-codesigning/action.yaml
  • .github/scripts/.Aptfile
  • .github/scripts/.Brewfile
  • .github/scripts/Build-Windows.ps1
  • .github/scripts/Package-Windows.ps1
  • .github/scripts/build-macos
  • .github/scripts/build-ubuntu
  • .github/scripts/package-macos
  • .github/scripts/package-ubuntu
  • .github/scripts/utils.pwsh/Ensure-Location.ps1
  • .github/scripts/utils.pwsh/Invoke-External.ps1
  • .github/scripts/utils.pwsh/Logger.ps1
  • .github/scripts/utils.zsh/check_macos
  • .github/scripts/utils.zsh/check_ubuntu
  • .github/scripts/utils.zsh/log_debug
  • .github/scripts/utils.zsh/log_error
  • .github/scripts/utils.zsh/log_group
  • .github/scripts/utils.zsh/log_info
  • .github/scripts/utils.zsh/log_output
  • .github/scripts/utils.zsh/log_status
  • .github/scripts/utils.zsh/log_warning
  • .github/scripts/utils.zsh/mkcd
  • .github/scripts/utils.zsh/set_loglevel
  • .github/scripts/utils.zsh/setup_ubuntu
  • .github/workflows/build-project.yaml
  • .github/workflows/check-format.yaml
  • .github/workflows/dispatch.yaml
  • .github/workflows/pr-pull.yaml
  • .github/workflows/push.yaml
  • build-aux/.functions/log_debug
  • build-aux/.functions/log_error
  • build-aux/.functions/log_group
  • build-aux/.functions/log_info
  • build-aux/.functions/log_output
  • build-aux/.functions/log_status
  • build-aux/.functions/log_warning
  • build-aux/.functions/set_loglevel
  • build-aux/.run-format.zsh
  • build-aux/run-clang-format
  • build-aux/run-gersemi
  • build-aux/run-swift-format
  • cmake/macos/buildspec.cmake
  • flake.nix
  • justfile
  • src/moq-output.cpp
  • src/moq-output.h
  • src/moq-service.cpp
  • src/moq-service.h
  • src/moq-source.cpp
💤 Files with no reviewable changes (45)
  • .github/scripts/utils.zsh/mkcd
  • .github/scripts/.Brewfile
  • .github/scripts/utils.zsh/log_info
  • .github/scripts/utils.zsh/log_error
  • .github/scripts/utils.zsh/log_debug
  • .github/scripts/utils.zsh/log_warning
  • .github/scripts/utils.zsh/log_output
  • build-aux/run-clang-format
  • .github/scripts/.Aptfile
  • .github/scripts/utils.zsh/check_macos
  • build-aux/.functions/log_debug
  • .github/scripts/utils.zsh/log_status
  • cmake/macos/buildspec.cmake
  • .github/scripts/utils.pwsh/Ensure-Location.ps1
  • .github/scripts/utils.zsh/log_group
  • build-aux/run-gersemi
  • build-aux/.functions/log_error
  • build-aux/.functions/log_group
  • build-aux/run-swift-format
  • build-aux/.functions/log_info
  • .github/scripts/utils.zsh/set_loglevel
  • .github/workflows/dispatch.yaml
  • build-aux/.functions/set_loglevel
  • build-aux/.functions/log_status
  • build-aux/.functions/log_output
  • .github/workflows/check-format.yaml
  • .github/scripts/utils.zsh/check_ubuntu
  • .github/actions/setup-macos-codesigning/action.yaml
  • .github/actions/run-gersemi/action.yaml
  • .github/scripts/package-macos
  • .github/scripts/utils.zsh/setup_ubuntu
  • .github/scripts/utils.pwsh/Invoke-External.ps1
  • .github/scripts/build-ubuntu
  • .github/actions/check-changes/action.yaml
  • .github/scripts/Package-Windows.ps1
  • build-aux/.run-format.zsh
  • .github/scripts/utils.pwsh/Logger.ps1
  • .github/actions/run-clang-format/action.yaml
  • .github/workflows/build-project.yaml
  • .github/scripts/build-macos
  • .github/scripts/package-ubuntu
  • .github/scripts/Build-Windows.ps1
  • .github/actions/package-plugin/action.yaml
  • .github/actions/build-plugin/action.yaml
  • build-aux/.functions/log_warning

Comment on lines +36 to +43
libDeps =
with pkgs;
[
ffmpeg
]
++ lib.optionals stdenv.hostPlatform.isLinux [
obs-studio
];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if obs-studio is available for Darwin in nixpkgs
# and verify the CMake preset for macOS

# Check CMakePresets.json for macOS preset configuration
cat CMakePresets.json | jq '.configurePresets[] | select(.name == "macos")'

# Check if there's any OBS installation step in workflows
rg -n "obs-studio|brew.*obs|install.*obs" .github/workflows/

Repository: moq-dev/obs

Length of output: 679


🏁 Script executed:

# Verify CMakeLists.txt has find_package(libobs REQUIRED) on line 17
head -20 CMakeLists.txt | tail -10

Repository: moq-dev/obs

Length of output: 301


🏁 Script executed:

# Check the workflow files to confirm the exact commands run on macOS
rg -A 5 "macos-15|macos-" .github/workflows/ | head -60

Repository: moq-dev/obs

Length of output: 1152


🏁 Script executed:

# Search for CMakeLists.txt to understand the OBS requirement
fd CMakeLists.txt --exec head -30 {}

Repository: moq-dev/obs

Length of output: 1046


🌐 Web query:

obs-studio nixpkgs darwin macOS availability

💡 Result:

OBS Studio is not available in nixpkgs for Darwin/macOS platforms. The package's meta.platforms explicitly lists only Linux architectures: "x86_64-linux", "i686-linux", "aarch64-linux". Attempts to build it on Darwin (e.g., aarch64-darwin) fail because it is not supported. Open GitHub issues confirm this: #411190 (opened May 2025, marked stale) reports "obs-studio: not available on darwin platform", and #419380 requests Darwin support. Recent updates (e.g., PR #369193 for v31.0.1, merged Feb 2025) were not tested on Darwin and carry the "10.rebuild-darwin: 0" label, indicating no Darwin builds. NixOS wiki documentation focuses exclusively on Linux usage. Users on macOS with nix-darwin typically use alternatives like Homebrew for GUI apps including OBS Studio.

Citations:


macOS CI build will fail: obs-studio is not provided by the flake and unavailable in nixpkgs for Darwin.

The libDeps only includes obs-studio on Linux. On macOS, find_package(libobs REQUIRED) in CMakeLists.txt (line 15) fails when BUILD_PLUGIN is enabled, since obs-studio is not available in nixpkgs for Darwin. The workflows (.github/workflows/push.yaml:38-39 and .github/workflows/pr-pull.yaml:34-35) run nix develop --command just setup on macos-15 without providing OBS.

Consider:

  1. Installing OBS via brew in the workflow before running just setup
  2. Documenting that macOS builds require OBS to be pre-installed externally (since nixpkgs does not support Darwin)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@flake.nix` around lines 36 - 43, libDeps includes obs-studio only on Linux so
macOS CI fails because find_package(libobs REQUIRED) in CMake when BUILD_PLUGIN
is enabled cannot find OBS; fix by either (A) updating the macOS CI step that
runs "nix develop --command just setup" on macos-15 to install OBS beforehand
(e.g., use Homebrew to install or cask install obs) or (B) change CI to disable
BUILD_PLUGIN on Darwin (set BUILD_PLUGIN=OFF or similar env flag) and add a
clear note in documentation/README that macOS builds require OBS pre-installed
externally since obs-studio is not available in nixpkgs; reference libDeps,
obs-studio, BUILD_PLUGIN and find_package(libobs REQUIRED) when making the
change.

- Install just via chocolatey before running justfile commands
- Set shell: bash for just steps (justfile uses bash shebangs)
- Expand gersemi check/fix to include cmake/**/*.cmake files
- Update CLAUDE.md to reflect removal of build-aux scripts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@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/push.yaml:
- Around line 67-81: The workflow currently grants workflow-wide write
permissions; restrict default permissions to read-only and grant contents: write
only to the release job by adding a top-level permissions: contents: read (or
removing write) and adding a permissions: contents: write block inside the
release job definition (the job named "release" that uses
softprops/action-gh-release@v2 and downloads artifacts) so only that job
receives elevated token scope.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eabe7356-3a43-43d6-b516-d94d843ec909

📥 Commits

Reviewing files that changed from the base of the PR and between 421f4f6 and c248c21.

📒 Files selected for processing (4)
  • .github/workflows/pr-pull.yaml
  • .github/workflows/push.yaml
  • CLAUDE.md
  • justfile
✅ Files skipped from review due to trivial changes (2)
  • CLAUDE.md
  • .github/workflows/pr-pull.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • justfile

- Install pkgconfiglite via choco so CMake can find FFmpeg
- Set PKG_CONFIG_PATH to choco ffmpeg-full pkgconfig directory
- Consolidate choco installs into single step
- Scope contents:write to release job only (was workflow-wide)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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