Recommended approach to use Stack as global package manager

前端 未结 1 1086
青春惊慌失措
青春惊慌失措 2021-02-19 20:49

I would like to install some Haskell libraries globally, for example hindent which is used by my editor\'s Haskell integration. What is the recommended way to do th

相关标签:
1条回答
  • 2021-02-19 21:29

    Well, stack install in any project will install to ~/.local/bin therefore making whatever executable you install be globally accessible.

    The global project is used when running stack without a project, it is located in ~/.stack/global-project/stack.yaml.

    If you want all of your globally accessible tools to have the same dependencies (perhaps to ensure that the ghc version matches or something), then you could make a project intended to build all of these tools. It's up to you whether or not it is the "global project" - there's not much special about it, it's just a default if you run stack and aren't in a project.

    In order to record "what haskell executables do I want installed globally", you might consider creating a shell file like

    #!/bin/sh
    stack install hindent
    

    And then running this whenever you change the versions of the installed tools.

    Also, for tools like intero that need to match the ghc version, you can do stack install --copy-compiler-tool intero, and it will be available on the PATH when stack is used with that ghc version.

    0 讨论(0)
提交回复
热议问题