From 7e8deb4663a40bf3ea1f369a184bb4be97a1c7a8 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Fri, 3 Sep 2021 20:54:23 +0000 Subject: [PATCH 01/13] add a gitpod descriptor --- .gitpod.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .gitpod.yml diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000000..0714003687 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,28 @@ +# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/ +tasks: + - init: | + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh + source /home/gitpod/.ghcup/env + cabal build --enable-tests + + 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 From bb70e83eb457d7a507fadd96b075ab63d023c656 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sat, 4 Sep 2021 18:04:42 +0000 Subject: [PATCH 02/13] preinstall haskell extension and error lens --- .gitpod.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitpod.yml b/.gitpod.yml index 0714003687..ebfb53fad9 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -26,3 +26,9 @@ github: 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 From 9d37d5889e5348642cbda530ed9b977a3374e4fe Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sat, 4 Sep 2021 21:28:22 +0000 Subject: [PATCH 03/13] before --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index 0714003687..89cec42717 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -5,6 +5,7 @@ tasks: source /home/gitpod/.ghcup/env cabal build --enable-tests + before: source /home/gitpod/.ghcup/env command: cabal build --enable-tests # List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/ From 8986c63f5e2d1df28ebaeb4df634f7c5b6a9a3d3 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sun, 5 Sep 2021 07:54:15 +0000 Subject: [PATCH 04/13] fix tasks --- .gitpod.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index b7fff2e9f6..b733fb8268 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,12 +1,12 @@ # List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/ tasks: - - init: | + - before: | curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh source /home/gitpod/.ghcup/env + init: | + cabal build --enable-tests + command: | cabal build --enable-tests - - before: source /home/gitpod/.ghcup/env - command: cabal build --enable-tests # List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/ ports: [] From 7a8685f39a7cc0427baf2b47f50bfd170d0f7bf6 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sun, 5 Sep 2021 14:16:56 +0000 Subject: [PATCH 05/13] workspace --- .gitpod.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index b733fb8268..c25b87425f 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,8 +1,10 @@ # List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/ tasks: - - before: | - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh - source /home/gitpod/.ghcup/env + - before: | + export GHCUP_INSTALL_BASE_PREFIX=/workspace + export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh + source /workspace/.ghcup/env init: | cabal build --enable-tests command: | From d8e8e2687d1808888461137bd26682101e60a732 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sun, 5 Sep 2021 15:13:25 +0000 Subject: [PATCH 06/13] cabal dir --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index c25b87425f..456ceac5d5 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -3,6 +3,7 @@ tasks: - before: | export GHCUP_INSTALL_BASE_PREFIX=/workspace export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 + export CABAL_DIR=/workspace/.cabal curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh source /workspace/.ghcup/env init: | From 415602f85880de7ee9e243487fa5b74019d55ce5 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sun, 5 Sep 2021 15:21:55 +0000 Subject: [PATCH 07/13] stack root --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index 456ceac5d5..26facb7dc3 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -4,6 +4,7 @@ tasks: export GHCUP_INSTALL_BASE_PREFIX=/workspace export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 export CABAL_DIR=/workspace/.cabal + export STACK_ROOT=/workspace/.stack curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh source /workspace/.ghcup/env init: | From 427fcf384db3abd141baf2a99391784a6050897a Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sun, 5 Sep 2021 20:01:14 +0000 Subject: [PATCH 08/13] Make HLS work in gitpod --- .gitpod.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 26facb7dc3..b46b6c8b1f 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -6,7 +6,17 @@ tasks: export CABAL_DIR=/workspace/.cabal export STACK_ROOT=/workspace/.stack curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh - source /workspace/.ghcup/env + + # ensure that there is an HLS binary for the installed GHC version + ghcup install --set ghc 8.10.6 + + # Fix the default Cabal config since VSCode does not see CABAL_DIR + mkdir ~/.cabal + cp /workspace/.cabal/config ~/.cabal/config + + # Add ghcup binaries to the PATH since VSCode does not see 'source .ghcup/env' + cd /usr/local/bin + sudo ln -s /workspace/.ghcup/bin/* /usr/local/bin init: | cabal build --enable-tests command: | From 5470cf2fd06989c15d1e1ae146f8db200ba47131 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sun, 5 Sep 2021 20:14:19 +0000 Subject: [PATCH 09/13] tweaks --- .gitpod.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index b46b6c8b1f..1e8bd53954 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -3,20 +3,24 @@ tasks: - before: | export GHCUP_INSTALL_BASE_PREFIX=/workspace export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 + export BOOTSTRAP_HASKELL_MINIMAL=1 export CABAL_DIR=/workspace/.cabal export STACK_ROOT=/workspace/.stack curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh # ensure that there is an HLS binary for the installed GHC version - ghcup install --set ghc 8.10.6 + /workspace/.ghcup/bin/ghcup install ghc 8.10.6 --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 default Cabal config since VSCode does not see CABAL_DIR + cabal update mkdir ~/.cabal cp /workspace/.cabal/config ~/.cabal/config - - # Add ghcup binaries to the PATH since VSCode does not see 'source .ghcup/env' - cd /usr/local/bin - sudo ln -s /workspace/.ghcup/bin/* /usr/local/bin init: | cabal build --enable-tests command: | From 53904211b1c3e45b07320ca7576c10e12b2ca2ae Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sun, 5 Sep 2021 20:49:16 +0000 Subject: [PATCH 10/13] Fix GHC version --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 1e8bd53954..3eabbce9fd 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -9,7 +9,7 @@ tasks: curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh # ensure that there is an HLS binary for the installed GHC version - /workspace/.ghcup/bin/ghcup install ghc 8.10.6 --set + /workspace/.ghcup/bin/ghcup install ghc 8.10.5 --set /workspace/.ghcup/bin/ghcup install cabal # Add ghcup binaries to the PATH since VSCode does not see 'source .ghcup/env' From e29aac98dfaaa00665b4dc584d6dce8e9a12ca1a Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Mon, 6 Sep 2021 06:50:57 +0000 Subject: [PATCH 11/13] fix XDG dirs and use locally built HLS binary --- .gitpod.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 3eabbce9fd..3de625f3aa 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,15 +1,20 @@ # 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 - export CABAL_DIR=/workspace/.cabal - export STACK_ROOT=/workspace/.stack curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh - - # ensure that there is an HLS binary for the installed GHC version - /workspace/.ghcup/bin/ghcup install ghc 8.10.5 --set + /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' @@ -21,8 +26,15 @@ tasks: cabal update mkdir ~/.cabal cp /workspace/.cabal/config ~/.cabal/config + + # Configure VSCode to use the locally built version of HLS + mkdir -p .vscode + echo '{ "haskell.serverExecutablePath": "/workspace/.cabal/bin/haskell-language-server" }' > settings.json + init: | - cabal build --enable-tests + cabal configure --enable-executable-dynamic + cabal build --enable-tests + cabal install exe:haskell-language-server command: | cabal build --enable-tests From f81e04aa4b7880b60ffa7ade752fc03d8d6f14ca Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Mon, 6 Sep 2021 14:42:40 +0000 Subject: [PATCH 12/13] Better ensure that the Cabal home lives under /workspace --- .gitpod.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 3de625f3aa..d5818f1bf8 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -22,10 +22,10 @@ tasks: sudo ln -s /workspace/.ghcup/bin/* /usr/local/bin popd - # Fix the default Cabal config since VSCode does not see CABAL_DIR + # Fix the Cabal dir since VSCode does not see CABAL_DIR cabal update - mkdir ~/.cabal - cp /workspace/.cabal/config ~/.cabal/config + echo "Symlinking /workspace/.cabal to ~/.cabal" + ln -s /workspace/.cabal ~ # Configure VSCode to use the locally built version of HLS mkdir -p .vscode From 2067a634223886aba7410ef485bd92c69cb68e3b Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Mon, 6 Sep 2021 14:43:53 +0000 Subject: [PATCH 13/13] Fix location of VSCode settings --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index d5818f1bf8..749a1e4748 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -29,7 +29,7 @@ tasks: # Configure VSCode to use the locally built version of HLS mkdir -p .vscode - echo '{ "haskell.serverExecutablePath": "/workspace/.cabal/bin/haskell-language-server" }' > settings.json + echo '{ "haskell.serverExecutablePath": "/workspace/.cabal/bin/haskell-language-server" }' > .vscode/settings.json init: | cabal configure --enable-executable-dynamic