https://github.com/steven0351/haskell-vscode-devcontainer
VSCode devcontainer configuration with GHC, Stack, and HIE
https://github.com/steven0351/haskell-vscode-devcontainer
devcontainer development-environment glasgow-haskell-compiler haskell haskell-ide-engine haskell-stack language-server-protocol
Last synced: 2 months ago
JSON representation
VSCode devcontainer configuration with GHC, Stack, and HIE
- Host: GitHub
- URL: https://github.com/steven0351/haskell-vscode-devcontainer
- Owner: Steven0351
- License: mit
- Created: 2020-05-19T22:17:22.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-22T05:07:11.000Z (almost 4 years ago)
- Last Synced: 2025-04-02T04:42:40.323Z (2 months ago)
- Topics: devcontainer, development-environment, glasgow-haskell-compiler, haskell, haskell-ide-engine, haskell-stack, language-server-protocol
- Language: Dockerfile
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## DevContainer for GHC, Stack, Cabal, and HIE (Haskell IDE Engine) || HLS (Haskell Language Server)
### What is this?
This is a [DevContainer](https://code.visualstudio.com/docs/remote/containers) environment for Visual Studio Code, allowing automatically installing the Haskell compiler (GHC) and setting up the Haskell Language Server VS Code plugin.
### How to use this?
Follow the [Getting Started](https://code.visualstudio.com/docs/remote/containers#_getting-started) instructions to configure your Visual Studio Code and Docker to use with DevContainers.
Place the `.devcontainer` directory in the root of your project, and the next time you load the project, Visual Studio Code will prompt to re-open the project in a container:

**Note**: building the container might take a few minutes until all dependencies have finished downloading.
### How does it work?
Visual Studio Code supports [Developing inside a Container](https://code.visualstudio.com/docs/remote/containers) - using a Docker image as a development environment. It automates the process of creating the container image, as well as installing additional required extensions into the editor.
Pressing **Reopen in Container** will perform the automated steps to launch the container, and set up the environment.
For more information and setup, read the official documentation: https://code.visualstudio.com/docs/remote/containers
### What's in the box?
The `Dockerfile` contains the following:
1. Stack configured with `system-ghc: true` to prevent stack from installing another GHC.
2. A script to install some additional tools (such as git), as well as configuring a special user `vscode` to allow access from VSCode.The `devcontainer.json` provides the following additional configurations:
* build.args:
* GHC_VERSION - Defaults to 8.10.4
* Volumes:
* vscode-haskell-stack - A volume to store ~/.stack to prevent having to fetch and rebuild dependencies
* vscode-haskell-cache - A volume to store ~/.cache for hie-bios generated filesIt also has some additional configuration for VSCode. In particular, it configures the required extensions that have to be installed, and the name of the remote user (must match the one in the `Dockerfile`).
## Note on using Stack to generate new projects
Stack is preconfigured in the image to allow using system GHC. However, if you generate a new project in the DevContainer without specifying a resolver, it will attempt to choose the latest resolver compatible with your dependencies (if any have yet been defined). This means that Stack may download a newer GHC if the resolver is not compatible with the pre-installed GHC. This is undesireable since HIE and HLS have been compiled for the specific GHC version tagged. For GHC 8.6.5, the last Stack LTS available is 14.27. Currently, the 8.8.3 container can run `stack new` or `stack init` without any resolver arguments and use system GHC.