Skip to content

Commit 314c803

Browse files
authored
docs: document Nix development setup (#1077)
* docs: document Nix development setup Rename the README development section to a shorter Development heading and keep the contributor setup details collapsed in a details block. Describe nix-direnv as the preferred way to load the flake-backed development shell so contributors use the pinned pnpm, Rust toolchain, GitHub CLI, and project utilities from flake.nix. * docs: clarify Nix flake prerequisites Clarify that contributors should use the Nix flake development environment with the nix-command and flakes experimental features enabled. This keeps the README Nix-first while making the setup requirement explicit before nix-direnv loads the project shell.
1 parent ba2d04f commit 314c803

1 file changed

Lines changed: 22 additions & 8 deletions

File tree

‎apps/ccusage/README.md‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,31 +127,43 @@ bunx ccusage monthly --compact # Compact monthly report
127127

128128
Full documentation is available at **[ccusage.com](https://ccusage.com/)**
129129

130-
## Development Setup
130+
## Development
131131

132-
### Using Nix (Recommended for Contributors)
132+
<details>
133+
<summary>Nix-based contributor setup</summary>
133134

134-
For contributors and developers working on ccusage, we provide a Nix flake-based development environment:
135+
Use the Nix flake development environment. Install [Nix](https://nixos.org/) with the `nix-command` and `flakes` experimental features enabled, then use [nix-direnv](https://github.com/nix-community/nix-direnv) so the repository dev shell loads automatically when you enter the directory:
135136

136-
```bash
137+
```sh
137138
# Clone the repository
138139
git clone https://github.com/ryoppippi/ccusage.git
139140
cd ccusage
140141

141-
# Allow direnv (automatically loads Nix environment)
142+
# Allow direnv to load the Nix dev shell
142143
direnv allow
144+
```
145+
146+
The dev shell provides the pinned `pnpm`, Rust toolchain, GitHub CLI, and project utilities from `flake.nix`. It also installs package dependencies from `pnpm-lock.yaml` when needed.
147+
148+
If you do not use direnv, enter the shell manually:
143149

144-
# Or manually enter the development shell
150+
```sh
145151
nix develop
146152
```
147153

148-
This ensures consistent tooling versions across all contributors and CI systems. The development environment is defined in `flake.nix` and automatically activated via direnv when entering the project directory.
154+
Run the usual checks from inside the Nix environment:
155+
156+
```sh
157+
pnpm run format
158+
pnpm typecheck
159+
pnpm run test
160+
```
149161

150162
### Nix Package
151163

152164
The flake exposes `ccusage` as the default package and app:
153165

154-
```bash
166+
```sh
155167
nix run github:ryoppippi/ccusage
156168
nix run github:ryoppippi/ccusage -- codex daily --offline
157169
nix build github:ryoppippi/ccusage
@@ -167,6 +179,8 @@ nix flake check
167179

168180
The scheduled `update pricing` workflow runs the same commands and opens a PR when the locked input changes.
169181

182+
</details>
183+
170184
## Sponsors
171185

172186
### Featured Sponsor

0 commit comments

Comments
 (0)