Skip to content

Commit 68f2f11

Browse files
committed
ci(nix): use nix profile install instead of nix develop
- Replace nix develop --command with direct command execution - Add tools input to setup-nix action for per-job tool selection - Install only required tools per job (e.g., gitleaks job only installs gitleaks) - Remove cache-nix-action as nixpkgs binary cache handles caching - This should reduce CI setup time by avoiding devShell evaluation
1 parent 4afbb83 commit 68f2f11

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: 'Setup Nix'
22
description: 'Install Nix and configure cache'
3+
inputs:
4+
tools:
5+
description: 'Space-separated list of nixpkgs packages to install (e.g., "nodejs_24 pnpm_10 oxlint")'
6+
required: false
7+
default: 'nodejs_24 pnpm_10'
38
runs:
49
using: 'composite'
510
steps:
@@ -8,11 +13,16 @@ runs:
813
with:
914
github_access_token: ${{ github.token }}
1015

11-
- name: Cache Nix store
12-
uses: nix-community/cache-nix-action@b426b118b6dc86d6952988d396aa7c6b09776d08 # v7.0.0
13-
with:
14-
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', 'flake.lock', 'pnpm-lock.yaml') }}
16+
- name: Install tools from nixpkgs
17+
shell: bash
18+
run: |
19+
tools="${{ inputs.tools }}"
20+
packages=""
21+
for tool in $tools; do
22+
packages="$packages nixpkgs#$tool"
23+
done
24+
nix profile install $packages
1525
16-
- name: Load Nix development environment
26+
- name: Install pnpm dependencies
1727
shell: bash
18-
run: nix develop --command true
28+
run: pnpm install --frozen-lockfile

.github/workflows/ci.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ jobs:
2626

2727
- name: Setup Nix
2828
uses: ./.github/actions/setup-nix
29+
with:
30+
tools: gitleaks
2931

3032
- name: Run Gitleaks
31-
run: nix develop --command gitleaks detect --source . --config .gitleaks.toml
33+
run: gitleaks detect --source . --config .gitleaks.toml
3234

3335
lint:
3436
runs-on: ubuntu-latest
@@ -37,8 +39,10 @@ jobs:
3739
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3840
- name: Setup Nix
3941
uses: ./.github/actions/setup-nix
42+
with:
43+
tools: nodejs_24 pnpm_10 oxlint oxfmt similarity nixfmt tsgolint
4044
- name: Run Lint
41-
run: nix develop --command pnpm run lint
45+
run: pnpm run lint
4246

4347
build-and-test:
4448
runs-on: ubuntu-latest
@@ -50,10 +54,10 @@ jobs:
5054
uses: ./.github/actions/setup-nix
5155

5256
- name: Run Build
53-
run: nix develop --command pnpm run build
57+
run: pnpm run build
5458

5559
- name: Run Tests
56-
run: nix develop --command pnpm test
60+
run: pnpm test
5761

5862
coverage:
5963
runs-on: ubuntu-latest
@@ -64,7 +68,7 @@ jobs:
6468
- name: Setup Nix
6569
uses: ./.github/actions/setup-nix
6670
- name: Run Tests with Coverage
67-
run: nix develop --command pnpm run coverage
71+
run: pnpm run coverage
6872
- name: Create Coverage Badge
6973
uses: jaywcjlove/coverage-badges-cli@4e8975aa2628e3329126e7eee36724d07ed86fda # v2.2.0
7074
with:

0 commit comments

Comments
 (0)