feat(label): NixOSラベルにブランチ名を含める#804
Merged
Merged
Conversation
ブートエントリのラベルにブランチ名を含めることで、 どのブランチでビルドされた世代かすぐに判別できるようにします。 また`last-commit`ファイルを行ベースのテキストからNixのattrsetリテラル(`last-commit.nix`)に変更し、 `import`で直接読み込めるようにしました。 行インデックスによるフィールド参照が不要になり、 フィールドの追加・変更が容易になります。 close #803
Closed
Contributor
There was a problem hiding this comment.
Pull request overview
ブートエントリのラベルにブランチ名を含め、どのブランチでビルドされた世代かを判別しやすくするための変更です。併せて、install.shが注入していたlast-commitを行ベースのテキストからNixでimport可能なlast-commit.nix(attrset)に移行しています。
Changes:
- NixOSブートラベル生成(
system.nixos.label)にブランチ情報を組み込む last-commitをlast-commit.nix(attrset)に変更し、importで読み込む方式に変更install.shと.gitignoreを新ファイル名に追従
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| nixos/core/label.nix | last-commit.nixをimportしてdirty/branch/subject情報をラベルへ反映 |
| install.sh | last-commit.nix(Nix attrset)を生成して一時stagingする処理へ変更 |
| .gitignore | 注入用ファイルを/last-commit.nixとしてignore |
- dirtySuffix, branchLabel, commitLabelのハイフンの扱いを統一 - 不要なハイフンが付与される問題を解消
ブランチ名がないのは異常事態すぎるため。
`last-commit.nix`を`import`で読み込む方式は任意のNix式を評価するためセキュリティ上の懸念があります。 `last-commit.json`に変更し`builtins.fromJSON`で読み込むようにしました。 エスケープ処理もjqに任せることで安全かつ簡潔になります。 jqがPATHにない場合はgitと同様に`nix shell`で不足パッケージをまとめて取得して再実行します。
scopeがなくてもハイフンで区切られるように修正。
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.
ブートエントリのラベルにブランチ名を含めることで、
どのブランチでビルドされた世代かすぐに判別できるようにします。
また
last-commitファイルを行ベースのテキストからオブジェクトの明示的な集合に変更しました。close #803