summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yaml85
-rw-r--r--flake.nix39
2 files changed, 31 insertions, 93 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index e004fd3..cd5c05e 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -7,50 +7,36 @@ on:
workflow_dispatch:
jobs:
- eval:
- name: Evaluate flake
- runs-on: ubuntu-latest
-
- outputs:
- matrix: ${{ steps.evaluate.outputs.matrix }}
-
- steps:
- - uses: actions/checkout@v4
-
- - name: Install Nix
- uses: DeterminateSystems/nix-installer-action@v9
-
- - name: Evaluate matrix
- id: evaluate
- run: |
- set -eu
- echo "matrix=$(nix eval --show-trace --json .#githubWorkflow.matrix)" >> "$GITHUB_OUTPUT"
-
build:
- needs: eval
-
strategy:
fail-fast: false
- matrix: ${{ fromJSON(needs.eval.outputs.matrix) }}
-
- name: Build (${{ matrix.attr }})
+ matrix:
+ include:
+ - os: ubuntu-latest
+ system: x86_64-linux
+ - os: macos-latest
+ system: x86_64-darwin
+ - os: ubuntu-latest
+ system: aarch64-linux
+
+ name: Build (${{ matrix.system }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup QEMU
- if: matrix.arch == 'aarch64'
+ if: matrix.system == 'aarch64-linux'
uses: docker/setup-qemu-action@v3
with:
platforms: "arm64"
- name: Install Nix
- if: matrix.arch != 'aarch64'
+ if: matrix.system != 'aarch64'
uses: DeterminateSystems/nix-installer-action@v9
- name: Install Nix (with aarch64)
- if: matrix.arch == 'aarch64'
+ if: matrix.system == 'aarch64'
uses: DeterminateSystems/nix-installer-action@v9
with:
extra-conf: "extra-platforms = aarch64-linux arm-linux"
@@ -63,7 +49,18 @@ jobs:
- name: Run build
run: |
- nix build -L --accept-flake-config .#${{ matrix.attr }}
+ args=(
+ --inputs-from .
+ --override-input nixpkgs nixpkgs
+ github:Mic92/nix-fast-build -- \
+ --no-nom \
+ --skip-cached \
+ --systems '${{ matrix.system }}'
+ --option accept-flake-config true \
+ --flake '.#packages'
+ )
+
+ nix run "${args[@]}"
check:
strategy:
@@ -80,32 +77,12 @@ jobs:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9
- - name: Setup Cachix
- uses: cachix/cachix-action@v13
- with:
- name: getchoo
- authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
-
- name: Run check
- run: nix flake check --show-trace --accept-flake-config
-
- # https://github.com/orgs/community/discussions/26822#discussioncomment-3305794
- gate:
- needs: [build, check]
-
- name: CI Gate
- runs-on: ubuntu-latest
-
- if: always()
-
- steps:
- - name: Exit with result
run: |
- build_result="${{ needs.build.result }}"
- check_result="${{ needs.check.result }}"
-
- results=("$build_result" "$check_result")
-
- for result in "${results[@]}"; do [ "$result" != "success" ] && exit 1; done
+ args=(
+ --print-build-logs
+ --show-trace
+ --accept-flake-config
+ )
- exit 0
+ nix flake check "${args[@]}"
diff --git a/flake.nix b/flake.nix
index e7eee65..9cd5074 100644
--- a/flake.nix
+++ b/flake.nix
@@ -66,44 +66,5 @@
full = "big template for complex flakes (using flake-parts)";
nixos = "minimal boilerplate for flake-based nixos configuration";
};
-
- githubWorkflow.matrix = let
- inherit (nixpkgs) lib;
-
- ciSystems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- ];
-
- platforms = {
- "x86_64-linux" = {
- arch = "x64";
- os = "ubuntu-latest";
- };
-
- "aarch64-linux" = {
- arch = "aarch64";
- os = "ubuntu-latest";
- };
-
- "x86_64-darwin" = {
- arch = "x64";
- os = "macos-latest";
- };
- };
- in {
- include = lib.pipe ciSystems [
- (systems: lib.getAttrs systems self.packages)
-
- (lib.mapAttrsToList (system:
- lib.mapAttrsToList (attr: _: {
- inherit (platforms.${system}) os arch;
- attr = "packages.${system}.${attr}";
- })))
-
- lib.flatten
- ];
- };
};
}