Skip to content

Commit 519ce9f

Browse files
committed
Add job: nixpkgs-fmt. Parametrize nix_path from env
1 parent dde4ca2 commit 519ce9f

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

template/{% if github_actions %}.github{% endif %}/workflows/{% if nix %}nix.yml{% endif %}.jinja

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
branches:
1010
- master
1111

12+
env:
13+
NIX_CHANNEL: nixpkgs=channel:nixos-22.05
14+
1215
jobs:
1316
# This job checks if an identical workflow is being triggered by different
1417
# event and skips it. For instance there is no need to run the same pipeline
@@ -24,6 +27,18 @@ jobs:
2427
skip_after_successful_duplicate: 'true'
2528
concurrent_skipping: same_content
2629
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
30+
nixpkgs-fmt:
31+
needs: pre_job
32+
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: cachix/install-nix-action@v17
37+
with:
38+
nix_path: ${{ env.NIX_CHANNEL }}
39+
- uses: actions/checkout@v3
40+
- name: Check format
41+
run: nix-shell -p nixpkgs-fmt --run 'nixpkgs-fmt --check .'
2742
nix-build:
2843
needs: pre_job
2944
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
@@ -35,7 +50,7 @@ jobs:
3550
uses: cachix/install-nix-action@v17
3651
with:
3752
extra_nix_config: "system-features = nixos-test benchmark big-parallel kvm"
38-
nix_path: nixpkgs=channel:nixos-22.05
53+
nix_path: ${{ env.NIX_CHANNEL }}
3954
# Remove bellow step if you do not want to use Cachix - Nix binary cache.
4055
# For OpenSource projects there is free 5GB of storage.
4156
# https://www.cachix.org
@@ -66,7 +81,7 @@ jobs:
6681
- name: Install Nix
6782
uses: cachix/install-nix-action@v17
6883
with:
69-
nix_path: nixpkgs=channel:nixos-22.05
84+
nix_path: ${{ env.NIX_CHANNEL }}
7085
# Remove bellow step if you do not want to use Cachix - Nix binary cache.
7186
# For OpenSource projects there is free 5GB of storage.
7287
# https://www.cachix.org

0 commit comments

Comments
 (0)