Skip to content

Commit 3bbad6a

Browse files
authored
Update README.md
1 parent 937ab93 commit 3bbad6a

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

docs/design/README.md

+14-15
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ spam
3737
```
3838
* meant as a runnable script, equivalent of Rust's binary project
3939
* could use the `.nush` extension if we agree to support it
40-
* installed under `NUPM_CURRENT_OVERLAY/bin/`
40+
* installed under `NUPM_HOME/bin/`
4141

4242
2. Module
4343
```
@@ -47,18 +47,19 @@ spam
4747
└── mod.nu
4848
```
4949
* meant as a library to be `use`d or `overlay use`d, equivalent of Rust's library project
50-
* installed under `NUPM_CURRENT_OVERLAY/lib/`
50+
* installed under `NUPM_HOME/modules/`
5151

5252
You can also install non-Nushell packages as well using a "custom" project type where you specify a `build.nu` installation script
5353
(e.g., you can install Nushell itself with it).
5454
Plugins should also be supported, preferably not requiring fully custom `build.nu`.
55+
More "helper" types of projects could be made, e.g., installing from GitHub, etc. We could allow users to add new project types via "templates".
5556

5657
## Separate virtual environments [[toc](#table-of-content)]
5758

5859
> Inspiration: Python, [conda](https://docs.conda.io/en/latest), `cargo`
5960
60-
There are two different concepts in how to handle virtual environments:
61-
* Having global virtual environments, Python-style. We have a working prototype at [`kubouch/nuun`] using overlays.
61+
There are two different concepts how to handle virtual environments:
62+
* Global virtual environments, Python-style. We have a working prototype at [`kubouch/nuun`] using overlays.
6263
* Installing a package will install it to the environment
6364
* Possible to switch between them, they are completely isolated from each other
6465
* Per-project virtual environment, `cargo`-style
@@ -70,20 +71,20 @@ The overlays could be used to achieve all three goals at the same time. When ins
7071
* `nupm` adds entry to a **lock file** (this should be the only file you need to 100% replicate the environment)
7172
* 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
7273
* 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
74+
* Each overlay under `NUPM_HOME/overlays` will mimic the main NUPM_HOME structure, e.g., for an overlay `spam` there will be `NUPM_HOME/overlays/spam/bin`, `NUPM_HOME/overlays/spam/modules` (`NUPM_HOME/overlays/spam/overlays`? It might not be the best idea to have it recursive)
7375

7476
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.
7577

7678
## Installation, bootstraping [[toc](#table-of-content)]
7779

7880
Requires these actions from the user (this should be kept as minimal as possible):
7981
* Add `NUPM_HOME/bin` to PATH (install location for binary projects)
80-
* Add `NUPM_HOME/lib` to NU_LIB_DIRS
82+
* Add `NUPM_HOME/modules` to NU_LIB_DIRS
8183
* Add `NUPM_HOME/overlays` to NU_LIB_DIRS
8284
* Make the `nupm` command available somehow (e.g., `use` inside `config.nu`)
8385

8486
> :warning: **WIP**
85-
> I have another idea in mind, need to think about it. The disadvantage of this is that the default install location is not an overlay.
86-
> We could make `nupm` itself an overlay that adds itself as a command.
87+
> The disadvantage of this is that the default install location is not an overlay. We could make `nupm` itself an overlay that adds itself as a command, so that you can activate/deactivate it. We might need a few attempts to get to the right solution.
8788
8889
There are several approaches:
8990
* bootstrap using shell script sourced from web (like `rustup`)
@@ -101,19 +102,16 @@ dynamic are pre-compiled libraries linked to the project.
101102
> Nushell is [similar to compiled languages][Nushell compiled] rather than typical dynamic languages like Python, so these concepts are relevant for Nushell.
102103
103104
Static dependencies:
104-
* :thumbsup:: reproducible, does not rely on system files (no more missing `random.so.2`), higher performance (allows joint optimization of dependencies and project itself)
105+
* :thumbsup:: reproducible, does not rely on system files at runtime (no more missing `random.so.2`), higher performance (allows joint optimization of dependencies and project itself)
105106
* :thumbsdown:: increased compile time, binary size, can easily end up with multiple versions of the same library (hello Nushell dependencies)
106107

107108
Dynamic dependencies are the opposite basically.
108109

109-
> **Note**
110-
> Nushell currently supports only static dependencies, but we might be able to add the "linking" feature at some point.
111-
112-
We might want `nupm` support both types of dependencies.
110+
Nushell currently supports only static dependencies, but we might be able to add the "linking" feature at some point which could unlock new interesting patterns regarding package management, like testing.
113111

114112
## Package repository [[toc](#table-of-content)]
115113

116-
Packages need to be stored somewhere. There should be one central "official" location (see https://github.com/NixOS/nixpkgs for inspiration).
114+
Packages need to be stored somewhere. There should be one central "official" location (see https://github.com/NixOS/nixpkgs for inspiration). GitHub repository seems like a good starting point.
117115

118116
Additionally, user should be able to add 3rd party repositories as well as install local and other packages (e.g., from the web, just pointing at URL),
119117
as long as it has `METADATA_FILE` telling `nupm` what to do.
@@ -163,6 +161,7 @@ Nushell's module design conflates CLI interface with API -- they are the same. N
163161
- publish package to a repository
164162
- **NOT SUPPORTED FOR NOW**: the repository will be a *GitHub* repo with packages submitted by PRs to start with
165163

164+
The following are for Python-style global overlays, we might need to re-think this for local package overlays:
166165
- `nupm overlay new`
167166
- create a new global overlay (Python's virtual environment style)
168167
- `--local` flag could generate an overlay locally from the currently opened project
@@ -176,7 +175,7 @@ Nushell's module design conflates CLI interface with API -- they are the same. N
176175
- `nupm overlay import`
177176
- create overlay from exported file
178177

179-
### Other CLI-related points [[toc](#table-of-content)]
178+
### Other CLI-related notes [[toc](#table-of-content)]
180179

181180
* We could later think about being able to extend `nupm`, like `cargo` has plugins.
182181
* Mutable actions (like install) have by default Y/n prompt, but can be overriden with `--yes`
@@ -188,7 +187,7 @@ Nushell's module design conflates CLI interface with API -- they are the same. N
188187

189188
## Other [[toc](#table-of-content)]
190189

191-
* activations
190+
* activations (not bringing all package's content but only parts of it)
192191
* doc generation
193192
* test running
194193
* benchmark running

0 commit comments

Comments
 (0)