From 5afea908d8ee0c7e8bc4cb80935ef923e5732c7e Mon Sep 17 00:00:00 2001
From: Pepe Iborra <pepeiborra@gmail.com>
Date: Mon, 6 Sep 2021 22:45:21 +0200
Subject: [PATCH] Add a Gitpod descriptor (#2161)

* add a gitpod descriptor

* preinstall haskell extension and error lens

* before

* fix tasks

* workspace

* cabal dir

* stack root

* Make HLS work in gitpod

* tweaks

* Fix GHC version
---
 .gitpod.yml | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 .gitpod.yml

diff --git a/.gitpod.yml b/.gitpod.yml
new file mode 100644
index 00000000..749a1e47
--- /dev/null
+++ b/.gitpod.yml
@@ -0,0 +1,65 @@
+# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
+tasks:
+  - before: |
+      # Only the /workspace folder is persistent
+      export XDG_DATA_HOME=/workspace/.local/share
+      export XDG_CONFIG_HOME=/workspace/.local/config
+      export XDG_STATE_HOME=/workspace/.local/state
+      export XDG_CACHE_HOME=/workspace/.cache
+      export CABAL_DIR=/workspace/.cabal
+      export STACK_ROOT=/workspace/.stack
+
+      # install ghcup, ghc and cabal
+      export GHCUP_INSTALL_BASE_PREFIX=/workspace
+      export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
+      export BOOTSTRAP_HASKELL_MINIMAL=1
+      curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
+      /workspace/.ghcup/bin/ghcup install ghc --set
+      /workspace/.ghcup/bin/ghcup install cabal
+
+      # Add ghcup binaries to the PATH since VSCode does not see 'source .ghcup/env'
+      pushd /usr/local/bin
+      sudo ln -s /workspace/.ghcup/bin/* /usr/local/bin
+      popd
+
+      # Fix the Cabal dir since VSCode does not see CABAL_DIR 
+      cabal update
+      echo "Symlinking /workspace/.cabal to ~/.cabal"
+      ln -s /workspace/.cabal ~
+
+      # Configure VSCode to use the locally built version of HLS
+      mkdir -p .vscode
+      echo '{ "haskell.serverExecutablePath": "/workspace/.cabal/bin/haskell-language-server" }' > .vscode/settings.json 
+
+    init: | 
+      cabal configure --enable-executable-dynamic
+      cabal build --enable-tests
+      cabal install exe:haskell-language-server      
+    command: | 
+      cabal build --enable-tests
+
+# List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/
+ports: []
+
+github:
+  prebuilds:
+    # enable for the master/default branch (defaults to true)
+    master: true
+    # enable for all branches in this repo (defaults to false)
+    branches: false
+    # enable for pull requests coming from this repo (defaults to true)
+    pullRequests: true
+    # enable for pull requests coming from forks (defaults to false)
+    pullRequestsFromForks: true
+    # add a "Review in Gitpod" button as a comment to pull requests (defaults to true)
+    addComment: false
+    # add a "Review in Gitpod" button to pull requests (defaults to false)
+    addBadge: false
+    # add a label once the prebuild is ready to pull requests (defaults to false)
+    addLabel: prebuilt-in-gitpod
+
+vscode:
+  extensions:
+    - "haskell.haskell"
+    - "justusadam.language-haskell"
+    - "usernamehw.errorlens"
\ No newline at end of file
-- 
GitLab