Skip to content

Commit 93eabda

Browse files
authored
chore(nix): remove redundant tsgolint and add nix-workflow rule (#297)
* chore(nix): remove redundant tsgolint package The tsgolint binary is bundled with the oxlint package in nixpkgs, so specifying it separately is unnecessary. This removes the duplicate from both flake.nix and CI workflow. * 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. * chore(ci): remove unused similarity and nixfmt from lint job These tools are not used by pnpm lint (only oxfmt, oxlint, knip). * chore(nix): update flake.lock
1 parent 86bf01d commit 93eabda

5 files changed

Lines changed: 93 additions & 5 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

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Setup Nix
4242
uses: ./.github/actions/setup-nix
4343
with:
44-
tools: nodejs_24 pnpm_10 oxlint oxfmt similarity nixfmt tsgolint
44+
tools: nodejs_24 pnpm_10 oxlint oxfmt
4545
- name: Run Lint
4646
run: pnpm run lint
4747

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 |

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
# formatting and linting tools
3232
similarity
3333
nixfmt
34-
tsgolint
3534
oxlint
3635
oxfmt
3736

0 commit comments

Comments
 (0)