commercialhaskell / commercialhaskell/stack
[Feature Request]Add option to support build project in RAM like a tmpfs /tmp directory for reducing writing in SSD?
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
#### situation
- storage code in a SSD
- mount `/tmp` directory as a `tmpfs`
#### problem
When execute `stack build` once, compile stuffs will generate in the `.stack-work` directory, and almost 90Mb data will be written into the SSD. (depending on the dependencies)
This will reduce the lifespan of SDD.
#### solution
The `stack.yaml` configuration option `work-dir` specify the location where compile result generates, which value is `.stack-work`.
If replace `.stack-work` directory with a link to a temporary directory in `/tmp`, then `stack build` will generate compile results in RAM.
And check the real path of the link, `stack clean --full` could correctly delete the temporary directory.
#### feature request
Add option like `build-with-tmp: true|false` in `stack.yaml` configuration to support the solution.
PS:
I write a bash [script](https://gist.github.com/ukari/28db2e1afdc8c8400fd0beb94f540767) as a temporary solution.
Contributor guide
Assessment
This issue has not been assessed yet.