ci: introduce nixf-tidy-action

nixf-tidy-action is a nix linter based on libnixf. It detects deadcode, unused `rec`, and syntax errors. 

nixf-tidy-action will only report warnings on changed files in diff (thus it will not be very pedantic).

![nixf-sample](af8abbdc32_2_986x1000.png)
This commit is contained in:
Yingchi Long 2024-04-27 11:03:44 +08:00 committed by GitHub
parent 0fc190144f
commit 1c04f8539e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

25
.github/workflows/nixf-tidy-action.yaml vendored Normal file
View file

@ -0,0 +1,25 @@
name: nixf-tidy code linter
on:
[ pull_request ]
jobs:
nixf-tidy:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
extra_nix_config: |
trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://nix-community.cachix.org https://cache.nixos.org/
- run: nix profile install github:nix-community/nixd#nixd
- uses: inclyc/nixf-tidy-action@v1