[KISSA-46] ci(nix): nix flake check ジョブを追加 + Determinate 競合修正#16
Merged
gotomts merged 3 commits intoMay 13, 2026
Merged
Conversation
nix-darwin 側で Nix 管理を無効化し、Determinate Nix の daemon に委ねる。
nix-command / flakes は Determinate がデフォルト有効なため、旧来の
`nix.settings.experimental-features` 宣言は削除する。
S14 (CI 検証) の試運転で `darwin-rebuild switch` が以下のエラーで
失敗していたため発見した本番ブロッカー:
error: Determinate detected, aborting activation
Determinate uses its own daemon to manage the Nix installation that
conflicts with nix-darwin's native Nix management.
To turn off nix-darwin's management of the Nix installation, set:
nix.enable = false;
ローカル PC にも Determinate Nix が入っているため、本修正なしでは
m5mbp で `darwin-rebuild switch` を実行できない状態だった。CI で
事前検出できた本番投入ブロッカー。
PR で nix/ が変更されるたびに以下を実行する flake-check ジョブを追加: - nix flake check (構文 / 型 / 依存解決の壊れ検知) - nix build .#darwinConfigurations.m5mbp.system --no-link (closure 構築) 並行 Claude セッションへの影響なく drift を継続検知できる。Brewfile を 更新したのに homebrew.nix を直し忘れた、といったケースを物理防止する。 スコープ縮小の経緯: - 当初は ci 専用 host (username=runner) で `darwin-rebuild switch` まで CI で走らせる構成を試した - しかし本番 (m5mbp) と CI 環境 (runner / TCC / GUI / hardware) の差分を 埋める作業が膨らみ、本番投入の安全性向上に対して費用対効果が悪かった - 1 度の試運転で Determinate Nix と nix-darwin の競合 (前コミット `nix.enable = false`) を発見したことで CI の主目的は達成 - それ以降の iteration は CI 環境固有の問題に終始したため、ci-switch ジョブと ci host 定義は採用見送り - activation の検証は実機での `darwin-rebuild build` → `switch` で行う 設計: - runs-on: macos-latest (最新 macOS runner に自動追従) - DeterminateSystems/nix-installer-action でローカルと同じ Determinate Nix - run: で untrusted input (github.event.*) を一切評価しない (injection 対策) - concurrency で同一 ref の重複 run をキャンセルし課金を抑制
df58d1e to
af4fb2c
Compare
これまで feature/nix-migration-** への push でも push イベントが起動し、 同 SHA に対して pull_request イベントと二重に nix-check が走っていた。 concurrency group が github.ref ベース (push と pull_request で値が違う) なので互いに cancel されず、毎回手動で push 重複 run をキャンセルする 運用になっていた。 feature branch は PR 経由で常に pull_request イベントを発火させるため、 push トリガーは main の直接 push (hotfix 等) のみに絞る。
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.
Summary
PR で nix/ が変更されるたびに
nix flake checkとnix build .#m5mbp.system --no-linkを走らせる flake-check ジョブ を追加する。並行 Claude セッションを止めずに drift (例: Brewfile 更新時の homebrew.nix 追従漏れ) を継続検知できる。加えて、CI 試運転で発見した Determinate Nix と nix-darwin の競合 を
nix.enable = falseで解消する。変更内容
nix/hosts/m5mbp/darwin.nix:nix.settings.experimental-features宣言を削除し、nix.enable = falseに置換 (Determinate Nix daemon に管理を委ねる).github/workflows/nix-check.yml(新規):flake-checkジョブnix flake checknix build .#darwinConfigurations.m5mbp.system --no-linkスコープ縮小の経緯
当初は
darwin-rebuild switchまで CI で実行する案 (ci host 専用構成) を試したが:→ ci host / homebrew-ci.nix / ci-switch ジョブは採用見送り。activation の検証は実機での
darwin-rebuild build→switchで行う方針。検証
nix flake check✅nix build .#darwinConfigurations.m5mbp.system --no-link✅Test plan
nix-checkworkflow の動作確認となるsudo darwin-rebuild switch --flake .#m5mbpがnix.enable = false修正により完走する (実機検証)🤖 Generated with Claude Code