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).
|
2025-10-15 11:17:02 +02:00
|
|
|
|
|
|
|
|
## Shell
|
|
|
|
|
|
|
|
|
|
```sh
|
2026-02-09 18:22:20 +05:30
|
|
|
nix develop '.?submodules=1'
|
2025-10-15 11:17:02 +02:00
|
|
|
```
|
|
|
|
|
|
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
|
|
|
|
|
|
2025-10-15 11:17:02 +02:00
|
|
|
## Building
|
|
|
|
|
|
|
|
|
|
```sh
|
2026-02-09 18:22:20 +05:30
|
|
|
nix build '.?submodules=1#libsds'
|
|
|
|
|
nix build '.?submodules=1#libsds-android-arm64'
|
2025-10-15 11:17:02 +02:00
|
|
|
```
|
|
|
|
|
|
2026-02-09 18:22:20 +05:30
|
|
|
The `?submodules=1` part is required because vendored dependencies are git submodules.
|
2025-10-15 11:17:02 +02:00
|
|
|
|
2026-02-10 03:28:41 +05:30
|
|
|
## Utility apps
|
2025-10-15 11:17:02 +02:00
|
|
|
|
|
|
|
|
```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
|
2025-10-15 11:17:02 +02:00
|
|
|
```
|