Skip to content

Commit 32de1cd

Browse files
authored
Add notes about overlays; Misc comments
1 parent ab4bb1e commit 32de1cd

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

DESIGN.md

+17-9
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ There are two different concepts in how to handle virtual environments:
4949
* Per-project virtual environment, cargo-style
5050
* A project has its own universe (like Rust projects, for example)
5151

52-
The global environments are installed as overlays in a location added by user to `NU_LIB_DIRS` (`NUPM_HOME/overlays`).
53-
For example project `spam` would create `NUPM_HOME/overlays/spam.nu`). The features of the file:
54-
* automatically generated, managed by `nupm`
55-
* `overlay use spam.nu` brings in all the definitions in the virtual environment, no other action needed
56-
* `overlay hide` will restore the environment to the previous one
52+
Related to that is a lock file: It is intended to describe exactly the dependencies for a package so that it can be reproduced somewhere else.
5753

58-
Per-project environments use _identical_ framework with one difference: Instead of installing the overlay file to a global location,
59-
it is somewhere within the project. This also makes it opt-in. While `cargo` forces you to have all dependencies installed
54+
The overlays could be used to achieve all three goals at the same time. When installing a dependency for a package
55+
* `nupm` adds entry to a **lock file** (this should be the only file you need to 100% replicate the environment)
56+
* A .nu file (module) is auto-generated from the lock file and contains export statements like `export module NUPM_HOME/cache/packages/spam-v16.4.0-124ptnpbf/spam`. Calling `overlay use` on the file will activate your virtual environment, now you have a per-project environment
57+
* This file can be installed into a global location that's in your `NU_LIB_DIRS` (e.g., `NUPM_HOME/overlays`) -- now you have a global Python-like virtual environment
58+
59+
Each package would basically have its own overlay. This overlay file (it's just a module) could be used to also handle dependencies. If your project depends on `foo` and `bar` which both depend on `spam` but different versions, they could both import the different verions privately in their own overlay files and in your project's overlay file would be just `export use path/to/foo` and `export use path/to/bar`. This should prevent name clashing of `spam`. The only problem that needs to be figured out is how to tell `foo` to be aware of its overlay.
6060

6161
## Installation, bootstraping
6262

@@ -99,7 +99,7 @@ as long as it has `METADATA_FILE` telling `nupm` what to do.
9999

100100
## API / CLI Interface
101101

102-
Nushell's module design conflates CLI interface with API -- they are the same.
102+
Nushell's module design conflates CLI interface with API -- they are the same. Not all of the below are of the same priority.
103103

104104
- `nupm new [--script] [--module]`
105105
- create a new local package with template files ([`kubouch/nuun`])
@@ -143,7 +143,15 @@ Nushell's module design conflates CLI interface with API -- they are the same.
143143
- `nupm overlay import`
144144
- create overlay from exported file
145145

146-
We could later think about being able to extend nupm, like cargo has plugins.
146+
### Other CLI-related points
147+
148+
* We could later think about being able to extend nupm, like cargo has plugins.
149+
* Mutable actions (like install) have by default Y/n prompt, but can be overriden with `--yes`
150+
* By default, new projects are cross-platform:
151+
* Windows
152+
* MacOS
153+
* Linux
154+
* Android (if someone is willing to maintain it, we're not testing Nushell on Android, at least for now)
147155

148156
## Other
149157

0 commit comments

Comments
 (0)