nim-sds/nix/README.md

43 lines
1.1 KiB
Markdown
Raw Normal View History

2026-02-09 18:22:20 +05:30
# Nix Build System
The Nix configuration builds nim-sds by calling nimble tasks directly (no Makefile involved).
## Architecture
```
2026-02-10 03:28:41 +05:30
flake.nix — Entry point, defines packages, dev shell, and utility apps
2026-02-09 18:22:20 +05:30
├── nix/default.nix — Build derivation: configures env, runs nim <task> sds.nims
├── nix/shell.nix — Dev shell: sets up NIMBLE_DIR, nimble-links, NIM_LIB_DIR
└── nix/tools.nix — Helper: extracts version from sds.nimble
```
2026-02-10 03:28:41 +05:30
The Nim compiler comes from nixpkgs (pinned to 24.11, Nim 2.2.4).
2026-02-09 18:22:20 +05:30
All build logic lives in `sds.nimble` (nimble tasks).
## Shell
```sh
2026-02-09 18:22:20 +05:30
nix develop '.?submodules=1'
```
2026-02-09 18:22:20 +05:30
This automatically:
- Runs `scripts/generate_nimble_links.sh` to set up vendored dependencies
- Exports `NIMBLE_DIR` and `NIM_LIB_DIR`
- Creates the `sds.nims` symlink
## Building
```sh
2026-02-09 18:22:20 +05:30
nix build '.?submodules=1#libsds'
nix build '.?submodules=1#libsds-android-arm64'
```
2026-02-09 18:22:20 +05:30
The `?submodules=1` part is required because vendored dependencies are git submodules.
2026-02-10 03:28:41 +05:30
## Utility apps
```sh
2026-02-10 03:28:41 +05:30
nix run '.#setup' # Initialize git submodules (run once after clone)
nix run '.#clean' # Garbage-collect the Nix store
```