Skip to content

Commit 01c5719

Browse files
authored
Update docs (#1594)
1 parent 9e488db commit 01c5719

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

nimble-guide/docs/index.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,40 @@ Nimble packages are typically hosted in Git repositories so you may be able to g
3131

3232

3333

34+
## Automatic Nim Version Management
35+
36+
Nimble can automatically download and manage Nim versions for your projects. This feature ensures that each project uses the correct Nim version without manual intervention.
37+
38+
### How It Works
39+
40+
When you run Nimble commands like `build` or `install`:
41+
42+
1. **Nimble checks your project's Nim requirement** specified in the `.nimble` file (e.g., `requires "nim >= 2.0.0"`)
43+
2. **If a compatible Nim is not available**, Nimble automatically downloads a prebuilt binary from [nim-lang.org](https://nim-lang.org)
44+
3. **The downloaded Nim is cached** in `~/.nimble/nim/` and reused for future builds
45+
46+
### Benefits
47+
48+
- **No manual Nim installation required** - Just install Nimble and start building
49+
- **Per-project Nim versions** - Different projects can use different Nim versions
50+
- **Lock file support** - The exact Nim version can be pinned in `nimble.lock`
51+
- **Automatic updates** - When a project requires a newer Nim, it's downloaded automatically
52+
53+
### Using System Nim
54+
55+
Nimble will always try to match your system Nim version against the project's requirements. The `--useSystemNim` flag is used to bypass stricter constraints when you want to force the use of your locally installed Nim:
56+
57+
```sh
58+
nimble build --useSystemNim
59+
```
60+
61+
This is useful when:
62+
63+
- You have a custom Nim build
64+
- You're working offline and already have Nim installed
65+
- You want to test with a specific Nim version not available as a binary
66+
67+
3468
## Getting Started
3569

3670
- If you wish to explore existing Nim packages and install some of them, follow the [using packages guide](./use-packages.md).

nimble-guide/docs/nimble-reference.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,39 @@
7373
**Example**: `nim >= 0.10.0, jester`; with this value your package will
7474
depend on `nim` version 0.10.0 or greater and on any version of `jester`.
7575

76+
#### Local Path Dependencies
77+
78+
You can reference local packages using the `file://` protocol. This is useful for:
79+
80+
- Monorepo setups where multiple packages live in the same repository
81+
- Development of interdependent packages
82+
- Using local forks or modifications of packages
83+
84+
**Example**:
85+
```nim
86+
requires "file://./libs/myutil"
87+
requires "file://../shared/common"
88+
requires "file:///absolute/path/to/package"
89+
```
90+
91+
Paths can be relative (resolved from the package's directory) or absolute.
92+
93+
### Command Line Options
94+
95+
#### `--extra-requires`
96+
97+
Specify additional dependencies from the command line without modifying the `.nimble` file. This is useful for:
98+
99+
- Adding optional development dependencies
100+
- Testing with specific package versions
101+
- CI/CD pipelines that need additional packages
102+
103+
**Example**:
104+
```sh
105+
nimble build --extra-requires:"unittest2 >= 0.2.0"
106+
nimble install --extra-requires:"chronicles,stew"
107+
```
108+
109+
Multiple packages can be specified, separated by commas.
110+
76111

0 commit comments

Comments
 (0)