Skip to content

Commit 8cdfa28

Browse files
committed
docs(rules): add nix-workflow rule
Add comprehensive documentation for Nix usage in the project: - Development environment setup with flake.nix - CI workflow using nix profile install via setup-nix action - Tool configuration and adding new packages - Build flags for local development This helps maintain consistency when modifying Nix configuration.
1 parent 0364d7d commit 8cdfa28

2 files changed

Lines changed: 89 additions & 0 deletions

File tree

.claude/rules/nix-workflow.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Nix Workflow
2+
3+
This rule provides guidance on Nix usage in the StackOne SDK.
4+
5+
## Development Environment
6+
7+
The project uses `flake.nix` to define the development environment with `nix develop`.
8+
9+
### Adding Development Tools
10+
11+
To add a new tool to the development environment, add it to `buildInputs` in `flake.nix`:
12+
13+
```nix
14+
buildInputs = with pkgs; [
15+
# runtime
16+
nodejs_24
17+
pnpm_10
18+
19+
# formatting and linting tools
20+
oxlint # includes tsgolint
21+
oxfmt
22+
23+
# your new tool here
24+
new-tool
25+
];
26+
```
27+
28+
## CI Workflow
29+
30+
CI uses `nix profile install` via the `.github/actions/setup-nix/action.yaml` composite action.
31+
32+
### Adding Tools to CI Jobs
33+
34+
Specify tools in the `tools` input of the setup-nix action:
35+
36+
```yaml
37+
- name: Setup Nix
38+
uses: ./.github/actions/setup-nix
39+
with:
40+
tools: nodejs_24 pnpm_10 oxlint oxfmt
41+
```
42+
43+
The action installs packages using:
44+
45+
```bash
46+
nix profile install --inputs-from . nixpkgs#tool1 nixpkgs#tool2
47+
```
48+
49+
### CI Tool Configuration
50+
51+
- **Default tools**: `nodejs_24 pnpm_10` (defined in action.yaml)
52+
- **Skip pnpm install**: Set `skip-pnpm-install: 'true'` for jobs that don't need node dependencies
53+
54+
### Example: Adding a New Tool to Lint Job
55+
56+
```yaml
57+
lint:
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@v4
62+
- name: Setup Nix
63+
uses: ./.github/actions/setup-nix
64+
with:
65+
tools: nodejs_24 pnpm_10 oxlint oxfmt new-tool
66+
- name: Run Lint
67+
run: pnpm run lint
68+
```
69+
70+
## Build Flags
71+
72+
Always use these flags when running Nix build commands locally:
73+
74+
```bash
75+
--print-build-logs --show-trace
76+
```
77+
78+
Example:
79+
80+
```bash
81+
nix build --print-build-logs --show-trace
82+
nix flake check --print-build-logs --show-trace
83+
```
84+
85+
## Notes
86+
87+
- Some packages bundle multiple tools (e.g., `oxlint` includes `tsgolint`)
88+
- Check nixpkgs for package contents before adding redundant dependencies

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
1515
| **pnpm-usage** | All files | pnpm commands and troubleshooting |
1616
| **git-workflow** | All files | Commit conventions, branch strategy, PR guidelines |
1717
| **development-workflow** | All files | Code style, file naming, project conventions |
18+
| **nix-workflow** | All files | Nix development environment and CI setup |
1819
| **typescript-patterns** | `**/*.ts` | Type safety, exhaustiveness checks, clean code |
1920
| **typescript-testing** | `**/*.test.ts` | Vitest, MSW mocking, fs-fixture |
2021
| **file-operations** | `**/*.ts` | Native fetch API patterns and error handling |

0 commit comments

Comments
 (0)