Skip to content

Commit

Permalink
Add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis committed Jul 17, 2023
1 parent b29cd02 commit 569d4e8
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/nix-github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Nix Flake actions

on:
pull_request:
push:
branches:
- master
- main

jobs:
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$GITHUB_OUTPUT"
nix-build:
needs: nix-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Run Nix cache
uses: DeterminateSystems/magic-nix-cache-action@v1
- 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.

10 changes: 8 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-github-actions.url = "github:nix-community/nix-github-actions";
nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils, nix-github-actions }:
let
inherit (nixpkgs) lib;
in
{
libChecks = (import ./lib { inherit lib; }).tests;
githubActions = nix-github-actions.lib.mkGithubMatrix {
checks = { inherit (self.checks) x86_64-linux; };
};

lib = builtins.removeAttrs (import ./lib { inherit lib; }) [ "tests" ];

} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
Expand Down

0 comments on commit 569d4e8

Please sign in to comment.