Home > Enterprise >  Haskell stack in a project-specific location
Haskell stack in a project-specific location

Time:01-08

I'm following the guide here, which tells me:

The stack setup will download the compiler if necessary in an isolated location (default ~/.stack) that won't interfere with any system-level installations. (For information on installation paths, please use the stack path command.).

I'm trying to use a custom location, such as ~/myproject/myenvironment. When I use the stack path command, I see a lot of paths, such as stack-root, project-root, and config-location, but I don't see any way of setting the custom location with stack path. How can I sequester my stack to not operate out of ~/.stack but by a custom location? What arguments can I give stack update for example to localize to ~/myproject/myenvironment?

CodePudding user response:

Set the environment variable STACK_ROOT.
The parameter --stack-root of stack command works for one call only.
The stack path --stack-root command is used only to list the variable.

Resources:

Haskell Stack User Guide chapter Setting stack root location
https://github.com/commercialhaskell/stack/issues/1148

stack --help
...
  --stack-root STACK-ROOT  Absolute path to the global stack root directory
                           (Overrides any STACK_ROOT environment variable)
...
stack path --help
...
  --stack-root             Global stack root directory
...
  •  Tags:  
  • Related