[feat] GH nix builds

This commit is contained in:
aprilthepink 2024-04-09 20:16:59 +02:00
parent 9bc640aadc
commit 3f4618d4d2
2 changed files with 36 additions and 0 deletions

33
.github/workflows/nix-flake.yml vendored Normal file
View file

@ -0,0 +1,33 @@
name: Nix Flake actions
on:
pull_request:
push:
branches:
- main
- feat/*
jobs:
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
matrix="$(nix eval --json '.#githubActions.matrix')"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
nix-build:
needs: nix-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
- run: nix build -L ".#${{ matrix.attr }}"

View file

@ -22,6 +22,9 @@
imports = [
inputs.treefmt-nix.flakeModule
];
flake = { config, self', inputs', ... }: {
githubActions = inputs.nix-github-actions.lib.mkGithubMatrix { checks = self'.packages; };
};
perSystem = { config, self', pkgs, lib, system, ... }:
let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);