Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
LordGrimmauld committed Dec 15, 2024
1 parent 749fbb6 commit f398d18
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 3 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/nix-github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Nix Flake actions

on:
pull_request:
push:

jobs:
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
matrix="$(nix eval --json '.#githubActions.matrix')"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
nix-build:
name: ${{ matrix.name }} (${{ matrix.system }})
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@v30
- run: nix build -L '.#${{ matrix.attr }}'
21 changes: 21 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";

nix-github-actions = {
url = "github:nix-community/nix-github-actions";
inputs.nixpkgs.follows = "nixpkgs";
};
};

# test_vm.nix
Expand All @@ -12,6 +17,7 @@
{
self,
nixpkgs,
nix-github-actions,
flake-utils,
}:
(flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (
Expand Down Expand Up @@ -39,9 +45,13 @@
in
{
packages = flake_packages;
checks = flake_packages // {
};
checks = flake_packages;
formatter = pkgs.nixfmt-rfc-style;
}
));
))
// {
githubActions = nix-github-actions.lib.mkGithubMatrix {
checks = nixpkgs.lib.getAttrs [ "x86_64-linux" ] self.checks;
}; # todo: figure out testing on aarch64-linux
};
}

0 comments on commit f398d18

Please sign in to comment.