From 56f7fe5d9a78793d671e84ec10eee132ef273645 Mon Sep 17 00:00:00 2001 From: moons-14 Date: Thu, 9 Apr 2026 02:00:18 +0900 Subject: [PATCH] action file --- .github/workflows/nix-cache.yml | 71 +++++++++++++++++++++++++++++++++ .gitignore | 2 +- modules/core/cachix.nix | 11 +++++ modules/core/default.nix | 5 +-- 4 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/nix-cache.yml create mode 100644 modules/core/cachix.nix diff --git a/.github/workflows/nix-cache.yml b/.github/workflows/nix-cache.yml new file mode 100644 index 0000000..9f8e195 --- /dev/null +++ b/.github/workflows/nix-cache.yml @@ -0,0 +1,71 @@ +name: nix-build-and-cache + +on: + pull_request: + paths: + - "flake.nix" + - "flake.lock" + - "hosts/**" + - "modules/**" + - "profiles/**" + - "overlays/**" + - ".github/workflows/nix-cache.yml" + push: + branches: + - main + paths: + - "flake.nix" + - "flake.lock" + - "hosts/**" + - "modules/**" + - "profiles/**" + - "overlays/**" + - ".github/workflows/nix-cache.yml" + workflow_dispatch: + +concurrency: + group: nix-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + host: + - x1g9 + - x1g13-wsl + - x1g13 + - monitor + - dev-1 + - service-1 + + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Install Nix + uses: cachix/install-nix-action@v31 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + extra_nix_config: | + accept-flake-config = true + + - name: Setup Cachix for PR + if: github.event_name == 'pull_request' + uses: cachix/cachix-action@v17 + with: + name: moons-dotfiles + skipPush: true + + - name: Setup Cachix for main push + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: cachix/cachix-action@v17 + with: + name: moons-dotfiles + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + + - name: Build host + run: | + nix build -L .#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel diff --git a/.gitignore b/.gitignore index e692a32..a7f6ba0 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,4 @@ !/overlays/ !renovate.json - +!.github/ diff --git a/modules/core/cachix.nix b/modules/core/cachix.nix new file mode 100644 index 0000000..aa8ef45 --- /dev/null +++ b/modules/core/cachix.nix @@ -0,0 +1,11 @@ +{...}: { + nix.settings = { + extra-substituters = [ + "https://moons-dotfiles.cachix.org" + ]; + + extra-trusted-public-keys = [ + "moons-dotfiles.cachix.org-1:WHoroKiNScG2/dpxHHL1I0qVmvuQhJbEAP+DS2j9Rr0=" + ]; + }; +} diff --git a/modules/core/default.nix b/modules/core/default.nix index a30fd4a..196cbe6 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -1,8 +1,7 @@ -{ ... }: - -{ +{...}: { imports = [ ./boot.nix + ./cachix.nix ./environment.nix ./fonts.nix ./gc.nix