Nebble is a Nim wrapper library for Pebble smartwatch development. This guide will walk you through installation, creating your first app, and understanding the API structure.
We strongly recommend installing Nim using choosenim to ensure you have the latest version and consistent environment for documentation generation.
macOS / Linux:
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
After installation, verify with:
nim --version
To develop for Pebble, you need the Pebble SDK. Follow the instructions at the RePebble SDK Installation Guide for your platform (Windows, macOS, or Linux).
Verify that the pebble command is in your PATH:
pebble --version
nimble install nebble
git clone https://github.com/Brokezawa/nebble.git cd nebble nimble install
The Nebble CLI is automatically installed when you run nimble install nebble. Verify the installation:
nebble version
If the command is not found, ensure your Nimble bin directory is in your PATH:
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.) export PATH="$HOME/.nimble/bin:$PATH"
# Create a new project called "my_first_app" nebble new my_first_app cd my_first_app
This generates the project structure:
my_first_app/
├── package.json # Pebble SDK project metadata
├── nim.cfg # Cross-compilation flags
├── wscript # Waf build configuration
└── src/
├── my_first_app.nim # Your Nim watchapp source
└── pkjs.nim # Your Nim phone-side logic
Open src/my_first_app.nim. Nebble provides a Declarative DSL to minimize boilerplate:
import nebble # Handlers proc selectClickHandler(recognizer: ClickRecognizerRef; context: pointer) {.cdecl.} = vibes.shortPulse() # Declarative UI and interaction nebbleApp: textLayer: id = myLabel fullWidth = true y = center h = 40 text = "Hello Nim!" alignment = GTextAlignmentCenter clicks: BUTTON_ID_SELECT = selectClickHandler
nebble build
This command triggers the entire pipeline:
Nebble provides aliases for common Pebble commands for consistency:
# Start emulator and install the unified bundle nebble install --emulator basalt # Or install to all platforms at once nebble install --emulator all
Note: `nebble install` is a wrapper around `pebble install` that defaults to using the unified `.pbw` from the `build/` directory.
Nebble works on Windows, macOS, and Linux. The CLI tool abstracts platform differences:
Nebble has a two-layer architecture:
Always prefer the High-Level API for application logic to benefit from automatic memory management and type safety.
Nebble is a Full-Stack framework. When you create a project, you get a src/pkjs.nim file. This is where you write your phone-side logic (Net requests, GPS, etc.) in Nim. It shares the same types and keys as your watch code. See the Full-Stack Guide for details.