feat(nix): devenv の binary cache をグローバル設定に追加 - #55
Merged
Conversation
devenv を使う flake が nixConfig で宣言する devenv.cachix.org は、 accept-flake-config = false のため direnv 経由の非対話な shell 進入では untrusted 扱いで無視され、devenv 関連の derivation をローカルビルドしうる。 任意の flake 設定を無条件に信頼する accept-flake-config は使わず、 nix.settings に extra-substituters として明示追加する。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B728bRGMNmi5y46N3Xwe1H
Nix Diffkohei-m4-mac-miniAttribute: Diff OutputSC-N-843Attribute: Diff Output
Generated by nix-diff-action using dix |
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.
背景
devenv を使う flake (例: trihermes) で direnv 経由の shell 進入時に毎回以下の警告が出ていた。
その flake が
nixConfigで devenv の cachix を宣言しているが、こちらの nix 設定がaccept-flake-config = falseであり、direnv は非対話のため確認プロンプトを出せず無視される。結果として devenv.cachix.org が使われず、devenv 関連の derivation をローカルビルドしうる。
accept-flake-config = trueは任意の flake の設定を無条件に信頼することになるので採らず、グローバルの
nix.settingsに substituter を明示追加する方針とした。変更内容
nix-darwin/modules/nix.nixのnix.settingsに追加:extra-substituters:https://devenv.cachix.orgextra-trusted-public-keys:devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=デフォルトの cache.nixos.org を潰さないよう
extra-プレフィックスを使用。コメントの書き方・リストの並べ方は
nixos/modules/common.nixの同種の設定に合わせている。nixos (oberon) 側には追加していない。リポジトリ内に devenv の参照がなく、
oberon で devenv を使っている形跡がないため。
検証
nix fmt→ 105 files, 0 changednix build .#darwinConfigurations.kohei-m4-mac-mini.system --no-link→ 成功nix build .#darwinConfigurations.SC-N-843.system --no-link→ 成功etc/nix/nix.confに以下が出力され、substituters = https://cache.nixos.org/が維持されていることを確認済み
switch 後の
nix config show | grep substitutersでの確認は未実施。🤖 Generated with Claude Code
https://claude.ai/code/session_01B728bRGMNmi5y46N3Xwe1H