堆栈安装可执行文件到自定义位置

stack install executable to a custom location

我通常做 stack install <package-name> 并且 Stack 将它安装在位置 ~/.local/bin

有没有办法让我指定目的地位置?

您可以使用 --local-bin-path 来指定您的自定义目标路径。演示:

$ stack install tldr --local-bin-path /home/sibi
Copying from /home/sibi/github/tldr-hs/.stack-work/install/x86_64-linux/lts-12.10/8.4.3/bin/tldr to /home/sibi/tldr

Copied executables to /home/sibi:
- tldr

Warning: Installation path /home/sibi not found on the PATH environment variable.
$ ls -lh /home/sibi/tldr
-rwxr-xr-x 1 sibi sibi 3.0M Dec 23 01:37 /home/sibi/tldr