Skip to content

Feature request: ability to install executables into a specific directory #1198

@W1M0R

Description

@W1M0R

I want to create my own virtual environment, but not using this method: https://docs.pkgx.sh/pkgx/pkgx#virtual-environments

Instead, I would like pkgx to gather all the selected packages and install them into a custom location, as a flat list of files. I would use this specifically for single-file executables.

I would imagine doing something like this: pkgx --install-dir "some-location" gum glow hx@123

An ls of some-location would produce:

> ls some-location
gum
glow
hx

I would then do:

export PATH=some-location:$PATH
gum --version
glow --version
hx --version

I would expect this method to download the tools to the regular pkgx cache location, and that install-dir would just copy (or link) the binaries to some-location. If I re-run the command, it should see that the binaries are already available in the cache, and then just re-copy/re-link them (if needed).

I wouldn't want the command to delete existing contents in some-location, but instead, it should append to some-location:

> ls some-location
(empty)
> pkgx --install-dir some-location gum
> ls some-location
gum
> pkgx --install-dir some-location glow
> ls some-location
gum
glow

Additional flags could be added that could request a recreate of some-location, instead of an append.

I wouldn't use this feature for packages that consist of multiple files, but if someone chooses to do so, I would expect the contents of that package to be copied into some-location.

I am already doing something like this manually using ubi, since a long Path environment variable on Windows becomes problematic. This is to overcome the following issue I am having with Mise: jdx/mise#5830

Seeing how the + syntax sets the Path (https://docs.pkgx.sh/appendix/faq#where-do-you-put-pkgs), it is clear that long fully-qualified locations are preferred by pkgx, which will surely cause similar issues on Windows as it does for Mise. Having the ability to copy the tools into some-location so that we can control our own Path, would be very helpful.

Similar functionality exists in aqua: https://aquaproj.github.io/docs/guides/build-container-image/#notes-of-aqua-cp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions