haskell / hie-bios

Set up a GHC API session for various Haskell Projects

Home Page:https://hackage.haskell.org/package/hie-bios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support returning the modified PATH

ndmitchell opened this issue · comments

From https://github.com/digital-asset/ghcide/issues/294, if you stack install a package then any build tools (e.g. record-dot-preprocessor) seem to get put locally and added to the PATH locally by Stack. Maybe hie-bios needs to include that extra PATH information, so that tools building on it see the PATH too? Probably an additional field to ComponentOptions?

With recent stack versions, there is the command stack config env that prints the modified path. Could be useful for this!
Example output:

> stack config env
GHC_ENVIRONMENT='-'; export GHC_ENVIRONMENT;
GHC_PACKAGE_PATH='/home/baldr/Documents/haskell/fprog/.stack-work/install/x86_64-linux-nix/80444f540c4822726693e9a6f829471e2418b26f60fd37aa1ddd1f531fd9d952/8.6.5/pkgdb:/home/baldr/.stack/snapshots/x86_64-linux-nix/80444f540c4822726693e9a6f829471e2418b26f60fd37aa1ddd1f531fd9d952/8.6.5/pkgdb:/nix/store/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/lib/ghc-8.6.5/package.conf.d'; export GHC_PACKAGE_PATH;
HASKELL_DIST_DIR='/home/baldr/Documents/haskell/fprog/.stack-work/dist/x86_64-linux-nix/Cabal-2.4.0.1'; export HASKELL_DIST_DIR;
HASKELL_PACKAGE_SANDBOX='/home/baldr/.stack/snapshots/x86_64-linux-nix/80444f540c4822726693e9a6f829471e2418b26f60fd37aa1ddd1f531fd9d952/8.6.5/pkgdb'; export HASKELL_PACKAGE_SANDBOX;
HASKELL_PACKAGE_SANDBOXES='/home/baldr/Documents/haskell/fprog/.stack-work/install/x86_64-linux-nix/80444f540c4822726693e9a6f829471e2418b26f60fd37aa1ddd1f531fd9d952/8.6.5/pkgdb:/home/baldr/.stack/snapshots/x86_64-linux-nix/80444f540c4822726693e9a6f829471e2418b26f60fd37aa1ddd1f531fd9d952/8.6.5/pkgdb:'; export HASKELL_PACKAGE_SANDBOXES;
PATH='/home/baldr/Documents/haskell/fprog/.stack-work/install/x86_64-linux-nix/80444f540c4822726693e9a6f829471e2418b26f60fd37aa1ddd1f531fd9d952/8.6.5/bin:/home/baldr/.stack/snapshots/x86_64-linux-nix/80444f540c4822726693e9a6f829471e2418b26f60fd37aa1ddd1f531fd9d952/8.6.5/bin:/home/baldr/.stack/compiler-tools/x86_64-linux-nix/ghc-8.6.5/bin:/nix/store/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/bin:/nix/store/lb3hli8d9536g45mndwfwyi6fpny0blh-bash-interactive-4.4-p23/bin:/nix/store/2xwxj5qrrc71asdk1wyq19nz9k845pzs-patchelf-0.9/bin:/nix/store/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/bin:/nix/store/291ldi6fqsbmkbvbs8is4mcg3jb64ld4-gcc-wrapper-8.3.0/bin:/nix/store/62x7m20m7lm8y8s17cbgha0sf3cmma19-gcc-8.3.0/bin:/nix/store/hblpx8x5w88igmwa4ydnsnb65s363lji-glibc-2.27-bin/bin:/nix/store/9v78r3afqy9xn9zwdj9wfys6sk3vc01d-coreutils-8.31/bin:/nix/store/gwwycf3w6cbj0gd2mpgblrdjc24f3cys-binutils-wrapper-2.31.1/bin:/nix/store/ajrrkivdfvp8dp4vdg5hp1h5hblmanc9-binutils-2.31.1/bin:/nix/store/hblpx8x5w88igmwa4ydnsnb65s363lji-glibc-2.27-bin/bin:/nix/store/9v78r3afqy9xn9zwdj9wfys6sk3vc01d-coreutils-8.31/bin:/nix/store/06q8j7z84zqjzcijvz90i4v7j5mfk4jl-git-2.23.1/bin:/nix/store/my5v4x1n5568vgziyc63vmc97nk8ril9-ncurses-6.1-20190112/bin:/nix/store/9v78r3afqy9xn9zwdj9wfys6sk3vc01d-coreutils-8.31/bin:/nix/store/0zdsw4qdrwi41mfdwqpxknsvk9fz3gkb-findutils-4.7.0/bin:/nix/store/dys98skw6ifw5qsqrhjxjjiydyfbg3nq-diffutils-3.7/bin:/nix/store/g2h4491kab7l06v9rf1lnyjvzdwy5ak0-gnused-4.7/bin:/nix/store/71y5ddyz8vmsw9wgi3gzifcls53r60i9-gnugrep-3.3/bin:/nix/store/84yafwjc6sga23vwsbahhymikjhfbnw4-gawk-5.0.1/bin:/nix/store/aawf0q16ql39w2gwv52qyjfzgbg5f22r-gnutar-1.32/bin:/nix/store/afyqk8219zfv5and3pqahzvn6bpmx3dq-gzip-1.10/bin:/nix/store/iws7dm1jij4lv09mbpwf9i8lc1d4b798-bzip2-1.0.6.0.1-bin/bin:/nix/store/j8fq1ksp37w88rx80blzazldi17f3x7s-gnumake-4.2.1/bin:/nix/store/rm1hz1lybxangc8sdl7xvzs5dcvigvf7-bash-4.4-p23/bin:/nix/store/lmi2nqb1cfzr3ps2zkq97q88zzkhp4mj-patch-2.7.6/bin:/nix/store/y04xj2mbc66zs53fackn1wwlrv31bv3y-xz-5.2.4-bin/bin'; export PATH;
STACK_EXE='/nix/store/8h0dkdjxjdrnvwsp8l0wp9infn9j010l-stack-2.1.3.1/bin/stack'; export STACK_EXE;

Can't we read PATH from the environment in the cabal wrapper program?

Indeed.

EDIT: I got sidetracked and forgot what I wanted to write and apparently pressed send by accident.