From 782b05c59e985b2c8e27e4e87975bfd743d060b3 Mon Sep 17 00:00:00 2001 From: xeals Date: Thu, 23 Feb 2023 10:51:53 +1100 Subject: [PATCH] ci: run checks --- .github/workflows/build.yml | 18 ++++++++++++++++++ flake.nix | 11 ++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0ac565a..8677d3c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,24 @@ on: pull_request: push: jobs: + + checks: + strategy: + matrix: + check: + - nixpkgs-fmt + - deadnix + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: action/checkout@v3 + - uses: cachix/install-nix-action@v19 + - name: Check ${{ matrix.check }} + # Depends on nixos/nix#7759 to simply `nix flake check` + run: + - export SYSTEM=$(nix eval --raw --impure --expr "builtins.currentSystem") + - nix run .#checks.$SYSTEM.${{ matrix.check }} + build-and-update: strategy: matrix: diff --git a/flake.nix b/flake.nix index fc2c6ee..9259520 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,16 @@ (_: drv: builtins.elem system (drv.meta.platforms or [ ])) (import ./pkgs/top-level/all-packages.nix { inherit pkgs; }); - devShells.ci = pkgs.mkShell { + checks = { + nixpkgs-fmt = pkgs.writeShellScriptBin "nixpkgs-fmt-check" '' + ${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check . + ''; + deadnix = pkgs.writeShellScriptBin "deadnix-check" '' + ${pkgs.deadnix}/bin/deadnix --fail . + ''; + }; + + devShells.ci = pkgs.mkShellNoCC { buildInputs = [ pkgs.nix-build-uncached ]; };