pvolok/mprocs

Prepend to $PATH instead of appending

Opened this issue · 1 comments

When using add_path, the string is appended to $PATH.

This is a bit of a bummer, because it doesn't allow for overriding the search path for existing binaries. In the case of e.g. virtual environments, that's exactly what we want to do. Actual virtualenv scripts prepend to $PATH, which allows them to pre-empt system binaries.

Additionally, neither add_path nor env expand environment variables, and there's also no option to insert the CWD. Otherwise, I could've done this:

env:
    PATH: "<CONFIG_DIR>/venv/bin:$PATH"
    VIRTUAL_ENV: "<CONFIG_DIR>/venv"

Instead I have to hardcode this:

env:
    PATH: "/home/detuur/dev/repos/corp_serv/venv/bin:/home/detuur/.cargo/bin:/home/detuur/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/home/detuur/.local/bin:/home/detuur/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
    VIRTUAL_ENV: "/home/detuur/dev/repos/corp_serv/venv"

To extend my env the way virtualenvs do, and this will obviously break if I ever move the directory.

pvolok commented

Oh, I thought it already worked the way you expected. Will fix.