Skip to content

Commit 90c60b5

Browse files
committed
Document $PKGX_DIR
1 parent f510e1c commit 90c60b5

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

docs/pkgx.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ deno 1.35.3
4242
If you want to ensure the latest version of “foo” is installed, use
4343
`pkgx mash pkgx/upgrade foo`.
4444

45-
4645
## Adding Additional Packages to the Execution Environment
4746

4847
It can be useful to run a program with additional packages in the environment.
@@ -54,7 +53,6 @@ pkgx +openssl cargo build
5453
Here `+pkg` syntax added OpenSSL to Cargo’s environment. Thus the build will
5554
see the OpenSSL headers and libraries.
5655

57-
5856
## Disambiguation
5957

6058
In some cases `pkgx foo` may be ambiguous because multiple packages provide
@@ -74,7 +72,6 @@ error: multiple projects provide `yarn`. please be more specific:
7472
In general it's a good idea to specify fully qualified names in
7573
scripts, etc. since you want these to work forever.
7674

77-
7875
## Running System Commands
7976

8077
It can be useful to run system commands with a package environment injected.
@@ -146,6 +143,23 @@ $ eval "$(pkgx mash pkgx/ensure +git)"
146143
# ^^ adds pkgx git to the environment *unless* it is installed to the system
147144
```
148145

146+
## “Virtual Environments”
147+
148+
You can set `PKGX_DIR` to have `pkgx` install packages there. This can be
149+
useful for creating “virtual environments” for various usages.
150+
151+
```sh
152+
$ export PKGX_DIR="$PWD/foo" # must be an absolute path or is ignored
153+
154+
$ pkgx +gum
155+
$ find foo
156+
foo/charm.sh/gum/v0.14.5/bin/gum
157+
158+
$ eval "$(pkgx +gum)"
159+
$ echo $PATH
160+
$PWD/foo/charm.sh/gum/v0.14.5/bin/gum:…
161+
```
162+
149163
## Other Common Needs
150164

151165
`pkgx` is not a package manager. Thus the command itself doesn’t typically

0 commit comments

Comments
 (0)