Skip to content

feat(label): NixOSラベルにブランチ名を含める#804

Merged
ncaq merged 8 commits into
masterfrom
nixos-label-branch
Mar 22, 2026
Merged

feat(label): NixOSラベルにブランチ名を含める#804
ncaq merged 8 commits into
masterfrom
nixos-label-branch

Conversation

@ncaq
Copy link
Copy Markdown
Owner

@ncaq ncaq commented Mar 22, 2026

ブートエントリのラベルにブランチ名を含めることで、
どのブランチでビルドされた世代かすぐに判別できるようにします。
またlast-commitファイルを行ベースのテキストからオブジェクトの明示的な集合に変更しました。

close #803

ncaq added 2 commits March 22, 2026 16:37
ブートエントリのラベルにブランチ名を含めることで、
どのブランチでビルドされた世代かすぐに判別できるようにします。
また`last-commit`ファイルを行ベースのテキストからNixのattrsetリテラル(`last-commit.nix`)に変更し、
`import`で直接読み込めるようにしました。
行インデックスによるフィールド参照が不要になり、
フィールドの追加・変更が容易になります。

close #803
@ncaq ncaq self-assigned this Mar 22, 2026
Copilot AI review requested due to automatic review settings March 22, 2026 07:57
@ncaq ncaq added Type: Feature New Feature Type: Refactoring Includes cleanup labels Mar 22, 2026
@ncaq ncaq linked an issue Mar 22, 2026 that may be closed by this pull request
Comment thread nixos/core/label.nix Outdated
Comment thread install.sh Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

ブートエントリのラベルにブランチ名を含め、どのブランチでビルドされた世代かを判別しやすくするための変更です。併せて、install.shが注入していたlast-commitを行ベースのテキストからNixでimport可能なlast-commit.nix(attrset)に移行しています。

Changes:

  • NixOSブートラベル生成(system.nixos.label)にブランチ情報を組み込む
  • last-commitlast-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.niximportしてdirty/branch/subject情報をラベルへ反映
install.sh last-commit.nix(Nix attrset)を生成して一時stagingする処理へ変更
.gitignore 注入用ファイルを/last-commit.nixとしてignore

Comment thread nixos/core/label.nix Outdated
Comment thread nixos/core/label.nix Outdated
Comment thread install.sh
Comment thread install.sh
Comment thread nixos/core/label.nix Outdated
ncaq added 5 commits March 22, 2026 17:05
- dirtySuffix, branchLabel, commitLabelのハイフンの扱いを統一
- 不要なハイフンが付与される問題を解消
ブランチ名がないのは異常事態すぎるため。
`last-commit.nix`を`import`で読み込む方式は任意のNix式を評価するためセキュリティ上の懸念があります。
`last-commit.json`に変更し`builtins.fromJSON`で読み込むようにしました。
エスケープ処理もjqに任せることで安全かつ簡潔になります。
jqがPATHにない場合はgitと同様に`nix shell`で不足パッケージをまとめて取得して再実行します。
Comment thread nixos/core/label.nix Outdated
scopeがなくてもハイフンで区切られるように修正。
Copilot AI review requested due to automatic review settings March 22, 2026 08:20
Comment thread install.sh
Comment thread nixos/core/label.nix
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

Comment thread nixos/core/label.nix
Comment thread nixos/core/label.nix
Comment thread install.sh
@ncaq ncaq merged commit 5dca7f4 into master Mar 22, 2026
14 checks passed
@ncaq ncaq deleted the nixos-label-branch branch March 22, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New Feature Type: Refactoring Includes cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NixOSのラベルにブランチ名を含める

2 participants