From a508cc301b88569b4da9a0ec273de665e554d7eb Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 19 Mar 2025 11:33:02 -0500 Subject: [PATCH] feat: use matrix for simpler and parallel host builds Also some general cleanup of the workflow YAML --- .forgejo/workflows/nix-build.yaml | 41 ------------------------- .forgejo/workflows/nix-flake-check.yaml | 25 --------------- .forgejo/workflows/pre-merge.yaml | 33 ++++++++++++++++++++ packages/hosts/beefcake.nix | 6 ++-- readme.md | 3 +- 5 files changed, 38 insertions(+), 70 deletions(-) delete mode 100644 .forgejo/workflows/nix-build.yaml delete mode 100644 .forgejo/workflows/nix-flake-check.yaml create mode 100644 .forgejo/workflows/pre-merge.yaml diff --git a/.forgejo/workflows/nix-build.yaml b/.forgejo/workflows/nix-build.yaml deleted file mode 100644 index 7925a20..0000000 --- a/.forgejo/workflows/nix-build.yaml +++ /dev/null @@ -1,41 +0,0 @@ -on: [push] -jobs: - check: - runs-on: nixos-host - steps: - - name: Checkout - uses: actions/checkout@v3 - - # cache not needed since we now run on the host directly - # - name: Load cached nix store - # id: cache-nix-store - # uses: actions/cache/restore@v4 - # with: - # path: /nix/store - # key: ${{ runner.os }}-nix-store - - - name: Build server - run: | - nix shell nixpkgs#nixos-rebuild -c nixos-rebuild build --flake .#beefcake --accept-flake-config - - - name: Build router - run: | - nix shell nixpkgs#nixos-rebuild -c nixos-rebuild build --flake .#router --accept-flake-config - - - name: Build desktop - run: | - nix shell nixpkgs#nixos-rebuild -c nixos-rebuild build --flake .#dragon --accept-flake-config - - - name: Build laptop - run: | - nix shell nixpkgs#nixos-rebuild -c nixos-rebuild build --flake .#foxtrot --accept-flake-config - - - name: Build default devShell - run: | - nix develop . --build - - # - name: Save nix store - # uses: actions/cache/save@v4 - # with: - # path: /nix/store - # key: ${{ steps.cache-nix-store.outputs.cache-primary-key }} diff --git a/.forgejo/workflows/nix-flake-check.yaml b/.forgejo/workflows/nix-flake-check.yaml deleted file mode 100644 index 021d09d..0000000 --- a/.forgejo/workflows/nix-flake-check.yaml +++ /dev/null @@ -1,25 +0,0 @@ -on: [push] -jobs: - check: - runs-on: nixos-host - steps: - - name: Checkout - uses: actions/checkout@v3 - - # cache not needed since we now run on the host directly - # - name: Load cached nix store - # id: cache-nix-store - # uses: actions/cache/restore@v4 - # with: - # path: /nix/store - # key: ${{ runner.os }}-nix-store - - - name: Check nix flake - run: | - nix flake check - - # - name: Save nix store - # uses: actions/cache/save@v4 - # with: - # path: /nix/store - # key: ${{ steps.cache-nix-store.outputs.cache-primary-key }} diff --git a/.forgejo/workflows/pre-merge.yaml b/.forgejo/workflows/pre-merge.yaml new file mode 100644 index 0000000..6a85cfe --- /dev/null +++ b/.forgejo/workflows/pre-merge.yaml @@ -0,0 +1,33 @@ +on: [push] +jobs: + build-host: + runs-on: nix-latest + strategy: + matrix: + info: + - host: beefcake + - host: router + - host: dragon + - host: foxtrot + - host: flipflop + steps: + - uses: actions/checkout@v3 + - name: Build host + run: | + nix shell nixpkgs#nixos-rebuild -c nixos-rebuild build --flake .#${{ matrix.info.host }} --accept-flake-config + + build-devshell: + runs-on: nix-latest + steps: + - uses: actions/checkout@v3 + - name: Build default devShell + run: | + nix develop . --build --accept-flake-config + + flake-check: + runs-on: nix-latest + steps: + - uses: actions/checkout@v3 + - name: Check nix flake + run: | + nix flake check --accept-flake-config diff --git a/packages/hosts/beefcake.nix b/packages/hosts/beefcake.nix index a521931..aa06469 100644 --- a/packages/hosts/beefcake.nix +++ b/packages/hosts/beefcake.nix @@ -1067,8 +1067,10 @@ # type ":host" does not depend on docker/podman/lxc "podman" "nix:docker://git.lyte.dev/lytedev/nix:latest" - "beefcake:host" - "nixos-host:host" + "nix-latest:docker://ghcr.io/nixos/nix:latest" + "nix-stable:docker://ghcr.io/nixos/nix:2.26.3" + # "beefcake:host" + # "nixos-host:host" ]; tokenFile = config.sops.secrets."forgejo-runner.env".path; hostPackages = with pkgs; [ diff --git a/readme.md b/readme.md index f841335..1a741fa 100644 --- a/readme.md +++ b/readme.md @@ -5,8 +5,7 @@ Nix for lytedev -[![flake check status](https://git.lyte.dev/lytedev/nix/badges/workflows/nix-flake-check.yaml/badge.svg)](https://git.lyte.dev/lytedev/nix/actions?workflow=nix-flake-check.yaml) -[![build status](https://git.lyte.dev/lytedev/nix/badges/workflows/nix-build.yaml/badge.svg)](https://git.lyte.dev/lytedev/nix/actions?workflow=nix-build.yaml) +[![pre-merge status](https://git.lyte.dev/lytedev/nix/badges/workflows/pre-merge.yaml/badge.svg)](https://git.lyte.dev/lytedev/nix/actions?workflow=pre-merge.yaml)