An open API service indexing awesome lists of open source software.

https://github.com/torahappy/ghcjs-devenv

A docker image to develop GHC/GHCJS 9 projects.
https://github.com/torahappy/ghcjs-devenv

cabal docker docker-compose ghc ghcjs ghcup haskell neovim stack

Last synced: about 2 months ago
JSON representation

A docker image to develop GHC/GHCJS 9 projects.

Awesome Lists containing this project

README

          

# GHCJS development environment

This docker image is a boilerplate for GHCJS develop environment. It has GHCUp with normal GHC and experimental GHCJS 9.x, necessary libraries and GIR files for `jsaddle-webkit2gtk`, X11 forwarding preset (for testing webkit2gtk), and neovim with coc-nvim (with haskell-language-server support).

## How to setup

Before setup, you need a workspace folder (different from this repository) and put `examples/docker-compose.yml` onto it. Then, run following commands:

1. `mkdir .stack-cache`
1. `mkdir .cabal-cache`
1. `mkdir -p .stack-cache/hooks/`
1. `curl https://raw.githubusercontent.com/haskell/ghcup-hs/master/scripts/hooks/stack/ghc-install.sh > .stack-cache/hooks/ghc-install.sh`
1. `chmod +x .stack-cache/hooks/ghc-install.sh`
1. `echo "system-ghc: false" >> .stack-cache/config.yaml`
1. `docker-compose up`

Connect to the container via `docker exec -it rdwp-myservice-1 /root/uid-remap.bash bash` or `ssh haskell@localhost -p2222` (password: haskell)

Edit project files via `nvim` or VSCode Docker Container with haskell plugin.

## How to build a project

Just run `stack build` (for GHC binary) or `cabal build` (for GHCJS binary) within your project.

For cabal with GHCJS, replacement of compiler and other tools is required. To do so, append

```
with-compiler: javascript-unknown-ghcjs-ghc-9.10.0.20240413
with-hc-pkg: javascript-unknown-ghcjs-ghc-pkg-9.10.0.20240413
```

to the `cabal.project` file and run

```
cabal build --with-hsc2hs=javascript-unknown-ghcjs-hsc2hs-9.10.0.20240413
```

whenever you build.