Skip to content

Commit 4507b84

Browse files
committed
ci(nix): use nix profile install instead of nix develop
Replace `nix develop --command` with `nix profile install --inputs-from .` for CI workflows. This avoids evaluating the full devShell and running shellHook on every job, which was unnecessarily slow. Changes: - Add `tools` input to setup-nix action for specifying required packages - Add `skip-uv-sync` input to skip Python dependency installation - Install only required tools per job (e.g., gitleaks job only needs gitleaks) - Remove Cachix setup (no longer needed without devShell) - Add submodule initialisation and MCP mock server setup to action - Update nix-flake.yaml to use install-nix-action directly
1 parent ae58614 commit 4507b84

3 files changed

Lines changed: 56 additions & 27 deletions

File tree

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
name: "Setup Nix"
2-
description: "Install Nix and configure Cachix"
2+
description: "Install Nix and configure cache"
3+
inputs:
4+
tools:
5+
description: 'Space-separated list of nixpkgs packages to install (e.g., "uv ty just")'
6+
required: false
7+
default: "uv ty just"
8+
skip-uv-sync:
9+
description: "Skip uv sync step (useful for jobs that do not need Python dependencies)"
10+
required: false
11+
default: "false"
312
runs:
413
using: "composite"
514
steps:
@@ -8,12 +17,34 @@ runs:
817
with:
918
github_access_token: ${{ github.token }}
1019

11-
- name: Setup Cachix (numtide)
12-
uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16
13-
with:
14-
name: numtide
15-
authToken: ""
20+
- name: Install tools from nixpkgs
21+
shell: bash
22+
run: |
23+
tools="${{ inputs.tools }}"
24+
packages=""
25+
for tool in $tools; do
26+
packages="$packages nixpkgs#$tool"
27+
done
28+
nix profile install --inputs-from . $packages
29+
30+
- name: Initialise git submodules
31+
if: inputs.skip-uv-sync != 'true'
32+
shell: bash
33+
run: |
34+
# Only initialise if submodules exist but are not yet checked out
35+
if [ -f .gitmodules ] && [ ! -f vendor/stackone-ai-node/package.json ]; then
36+
git submodule update --init --recursive
37+
fi
38+
39+
- name: Install Python dependencies
40+
if: inputs.skip-uv-sync != 'true'
41+
shell: bash
42+
run: uv sync --all-extras
1643

17-
- name: Load Nix development environment
44+
- name: Install MCP mock server dependencies
45+
if: inputs.skip-uv-sync != 'true'
1846
shell: bash
19-
run: nix develop --command true
47+
run: |
48+
if [ -f vendor/stackone-ai-node/package.json ]; then
49+
cd vendor/stackone-ai-node && pnpm install --frozen-lockfile
50+
fi

.github/workflows/ci.yaml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,18 @@ jobs:
2626

2727
- name: Setup Nix
2828
uses: ./.github/actions/setup-nix
29+
with:
30+
tools: gitleaks
31+
skip-uv-sync: "true"
2932

3033
- name: Run Gitleaks
31-
run: nix develop --command just gitleaks
34+
run: gitleaks detect --source . --config .gitleaks.toml
3235

3336
ci:
3437
runs-on: ubuntu-latest
3538
strategy:
3639
matrix:
3740
python-version: ["3.11", "3.13"]
38-
include:
39-
- python-version: "3.11"
40-
sync-extras: "--all-extras"
41-
- python-version: "3.13"
42-
sync-extras: "--all-extras"
4341
steps:
4442
- name: Checkout repository
4543
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -48,18 +46,17 @@ jobs:
4846

4947
- name: Setup Nix
5048
uses: ./.github/actions/setup-nix
51-
52-
- name: Install dependencies
53-
run: nix develop --command just install ${{ matrix.sync-extras }}
49+
with:
50+
tools: uv ty just bun pnpm_10 typescript-go
5451

5552
- name: Run Lint
56-
run: nix develop --command just lint
53+
run: just lint
5754

5855
- name: Run Ty
59-
run: nix develop --command just ty
56+
run: just ty
6057

6158
- name: Run Tests
62-
run: nix develop --command just test
59+
run: just test
6360

6461
coverage:
6562
runs-on: ubuntu-latest
@@ -72,12 +69,11 @@ jobs:
7269

7370
- name: Setup Nix
7471
uses: ./.github/actions/setup-nix
75-
76-
- name: Install dependencies
77-
run: nix develop --command just install --all-extras
72+
with:
73+
tools: uv just bun pnpm_10 typescript-go
7874

7975
- name: Run Tests with Coverage
80-
run: nix develop --command just coverage
76+
run: just coverage
8177

8278
- name: Create Coverage Badge
8379
uses: jaywcjlove/coverage-badges-cli@4e8975aa2628e3329126e7eee36724d07ed86fda # v2.2.0

.github/workflows/nix-flake.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ jobs:
2626
- name: Checkout repository
2727
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2828

29-
- name: Setup Nix
30-
uses: ./.github/actions/setup-nix
29+
- name: Install Nix
30+
uses: cachix/install-nix-action@0b0e072294b088b73964f1d72dfdac0951439dbd # v31.8.4
31+
with:
32+
github_access_token: ${{ github.token }}
3133

3234
- name: Check flake
33-
run: nix flake check --all-systems --show-trace
35+
run: nix flake check --all-systems --print-build-logs --show-trace

0 commit comments

Comments
 (0)