Skip to content

Instantly share code, notes, and snippets.

@re-xyr
Created April 26, 2022 06:02
Show Gist options
  • Save re-xyr/84e1b888f7af2e7781f0f8d38ecb0b0c to your computer and use it in GitHub Desktop.
Save re-xyr/84e1b888f7af2e7781f0f8d38ecb0b0c to your computer and use it in GitHub Desktop.
Script for quickly pulling up a working Haskell environment on Gitpod
#! /bin/bash
install() {
local tool=$1
if [ -z $tool ]; then
tool=ghc
fi
local version=$2
if [ -z $version ]; then
version=recommended
fi
ghcup install $1 $2
}
install_ghcup() {
hash ghcup >/dev/null 2>/dev/null
if [ $? -gt 0 ]; then
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh
fi
echo -e "\nsource /home/gitpod/.ghcup/env" >> /home/gitpod/.bashrc
source /home/gitpod/.ghcup/env
if [ ! -f /usr/bin/ghcup ]; then
sudo ln /home/gitpod/.ghcup/bin/ghcup /usr/bin/ghcup
fi
}
if [ -z $1 ]; then
install_ghcup
install ghc
install cabal
install stack
install hls
stack config set install-ghc false --global
stack config set system-ghc true --global
else
install $1 $2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment