Skip to content

docs(nix): experimental featuresの呼び出し契約を明文化 - #75

Merged
gotomts merged 1 commit into
mainfrom
docs/nix-feature-contract
Aug 29, 2026
Merged

docs(nix): experimental featuresの呼び出し契約を明文化#75
gotomts merged 1 commit into
mainfrom
docs/nix-feature-contract

Conversation

@gotomts

@gotomts gotomts commented Aug 29, 2026

Copy link
Copy Markdown
Owner

決定

このリポジトリは Nix 本体の設定 (/etc/nix/nix.conf) を所有しないnix/darwin.nixnix.enable = false により nix-darwin は nix.conf を生成せず(nix-darwin 側で managed config 一式が mkIf nix.enable に括られている)、nix.settings.experimental-features を書いても効かない。したがって nix-command / flakes の有効・無効はホスト任せで、Determinate Nix を入れてあっても無効なホストは実在する

この事実に合わせて:

  • 「Determinate が nix-command / flakes をデフォルト有効化済み」という記述を撤回する
  • bare な nix サブコマンドを呼ぶ側が用途単位--extra-experimental-features "nix-command flakes" を明示する契約にする
  • darwin-rebuild は自前で有効化して呼ぶ生成物なので明示不要
  • 恒久的な有効化は Determinate 公式の管理経路(per-host 判断)に委ね、dotfiles / nix-darwin では宣言しない

変更

案内文・コメント・回帰テストのコメントのみ。実行ロジックは変更していない。

ファイル 変更
nix/darwin.nix nix.enable = false のコメントを書き直し。nix.conf が nix-darwin の管理外になる帰結と呼び出し契約を明記
AGENTS.md 「重要な設計判断」に experimental-features の境界・実行契約・CI 例外を追加(詳細は nix/README.md へポインタ)。主要コマンドの nix build にフラグ追加。CI 検証節に、workflow 内が bare なのは installer action が有効化するためという例外説明を追加
nix/README.md 冒頭に「前提: experimental-features は用途単位で明示する」節を新設。bare な nix 例をすべてフラグ付きに修正(お試し表はコード block 化)
README.md クイックスタートの nix run nix-darwin にフラグ追加 + 理由
nix/scripts/install-nix.zsh コメントの記述を修正。NEXT STEPS の案内文 2 行にフラグ追加
setup/cutover.zsh pre-flight build のコメントを現行契約に修正(コードは変更なし。フラグは既に付いていた)
setup/tests/cutover.bats 回帰テストのコメントを現行契約に修正(実行コード・期待値は不変)

診断手順として grep -H experimental-features /etc/nix/nix.conf ~/.config/nix/nix.conf 2>/dev/null || true を README に載せているが、include / NIX_CONFIG 等の間接経路までは診断しないため「見つからない = 無効」とは断定せず、常にフラグを付ける方針として書いている。

検証

このブランチで実行した結果:

git diff --check                                       exit=0
zsh -n nix/scripts/install-nix.zsh setup/cutover.zsh   exit=0
bats setup/tests/cutover.bats                          6/6 ok   exit=0
USER=ciuser bats nix/tests/*.bats                     13/13 ok  exit=0

契約の前提は実機で実測している(読み取りのみ):

  • /etc/nix/nix.confbuild-users-group = nixbld の 1 行のみ。~/.config/nix/nix.conf 不在、NIX_CONFIG 未設定
  • bare nix evalexperimental Nix feature 'nix-command' is disabled / exit 1。フラグ付き → 2.34.6 / exit 0
  • determinate-nixd は存在する(= Determinate 導入済みでも無効)

未実施

  • Nix 設定の変更(/etc/nix/nix.conf 含む)
  • 実機への darwin-rebuild switch / setup/migrate.zsh 適用
  • パッケージ取得を伴う nix build / nix shell の実行

closure ビルドの実行確認は nix-check workflow に委ねる。

nix/darwin.nix の `nix.enable = false` により nix-darwin は /etc/nix/nix.conf を
生成せず、nix-command / flakes の有効・無効はホスト任せになる。Determinate Nix を
入れてあっても無効なホストは実在するため、「Determinate がデフォルト有効化済み」と
いう記述を撤回し、bare な nix サブコマンドを呼ぶ側が用途単位で
`--extra-experimental-features "nix-command flakes"` を明示する契約を明文化する。

Nix 設定そのものは所有せず、恒久的な有効化は Determinate 公式の管理経路に委ねる。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@gotomts
gotomts merged commit 6f8570b into main Aug 29, 2026
2 checks passed
@gotomts
gotomts deleted the docs/nix-feature-contract branch August 29, 2026 15:09
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