Skip to content

Add GitHub Actions validation for flake, NixOS config, and Home Manager eval#8

Merged
Uliboooo merged 4 commits into
mainfrom
copilot/valid-nix-configuration-flake
May 21, 2026
Merged

Add GitHub Actions validation for flake, NixOS config, and Home Manager eval#8
Uliboooo merged 4 commits into
mainfrom
copilot/valid-nix-configuration-flake

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

This PR adds CI coverage for the repository’s Nix setup so invalid flake/config changes are caught in GitHub Actions instead of at local rebuild time. It specifically validates both system (nixosConfigurations.desktop) and Home Manager (users.alice) evaluation paths.

  • Workflow added: Nix config validation in CI

    • New workflow: .github/workflows/nix-validate.yml
    • Triggers on pull_request and push to main
    • Adds timeout-minutes: 30
    • Installs Nix and runs:
      • nix flake check --system x86_64-linux
      • nix eval .#nixosConfigurations.desktop.config.system.build.toplevel.drvPath
      • nix eval .#nixosConfigurations.desktop.config.home-manager.users.alice.home.activationPackage.drvPath
  • Security hardening

    • Sets explicit least-privilege permissions:
      • permissions: { contents: read }
    • Pins third-party actions to commit SHAs:
      • actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 (v4)
      • cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 (v31)
permissions:
  contents: read

jobs:
  validate:
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
      - uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31
      - run: nix flake check --system x86_64-linux
      - run: nix eval .#nixosConfigurations.desktop.config.system.build.toplevel.drvPath
      - run: nix eval .#nixosConfigurations.desktop.config.home-manager.users.alice.home.activationPackage.drvPath

Copilot AI and others added 2 commits May 21, 2026 06:37
Copilot AI changed the title [WIP] Add valid nix configuration and flake for home-manager Add GitHub Actions validation for flake, NixOS config, and Home Manager eval May 21, 2026
Copilot AI requested a review from Uliboooo May 21, 2026 06:39
Copy link
Copy Markdown
Owner

@Uliboooo Uliboooo left a comment

Choose a reason for hiding this comment

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

  • push: のブランチが未指定のため、すべてのブランチへのpushで実行される。branches: [main] に絞り込むことを推奨。

  • actions/checkout@v4cachix/install-nix-action@v31 がタグ指定のみでSHA未固定。サプライチェーン攻撃のリスクがあるため、コミットSHAでのピン留めを推奨。

  • --show-trace によりエラー時に内部パスやホスト名(desktop)、ユーザー名(alice)がログに出力される。パブリックリポジトリの場合は情報漏洩に注意。

  • nix flake check はデフォルトですべてのシステムに対して実行される。対象システムを明示的に指定(例: --system x86_64-linux)することでCI時間の短縮と意図の明確化が図れる。

  • ジョブにタイムアウト設定がない。nix flake check は環境によって長時間かかることがあるため、timeout-minutes: の追加を推奨。

  • Nixバイナリキャッシュ(Cachix等)の設定がないため、毎回フルビルドになる可能性がある。CIの高速化のためキャッシュ設定の追加を検討。

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

  • push: のブランチが未指定のため、すべてのブランチへのpushで実行される。branches: [main] に絞り込むことを推奨。

  • actions/checkout@v4 と `cachix/instal...

対応コミットは c32301f です。pushmain のみに制限、Actions をSHAピン留め、--show-trace を除去、nix flake check --system x86_64-linux に変更、timeout-minutes: 30 を追加しました。キャッシュ設定(Cachix等)は追加依存/運用方針が絡むため今回は入れず、必要なら別PRで分離して対応します。

@Uliboooo Uliboooo marked this pull request as ready for review May 21, 2026 07:04
Copilot AI requested a review from Uliboooo May 21, 2026 07:05
@Uliboooo Uliboooo merged commit 7f83947 into main May 21, 2026
1 check passed
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.

valid nix configuration and flake, home-manager on github actions

2 participants