Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Simplified haskell devcontainer. #1705

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

PiotrJustyna
Copy link

@PiotrJustyna PiotrJustyna commented Dec 19, 2022

Proposing a new version of this dockerfile as the current one:

  • does not work on the new apple silicon machines
  • or on corporate machines where ssl certifications stop the ghcup installation.

The dockerfile is a bit simplified following the official ghcup installation instructions + the installation script is supplemented with GHCUP_CURL_OPTS variable which handles problematic ssl certificates (better solutions to this welcome!).Thank you @hasufell for suggesting to use the bootstrap variables (e.g. ghc version).

Linked issues I recently started:

I can confirm this works on an M1 MacBook pro and am hoping the community devcontainers for Haskell start supporting that platform soon.

vscode ➜ /workspaces/haskell-community $ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.5
vscode ➜ /workspaces/haskell-community $ ghci
GHCi, version 9.2.5: https://www.haskell.org/ghc/  :? for help
ghci> let a=2+2
ghci> a
4
ghci> 

@PiotrJustyna PiotrJustyna marked this pull request as ready for review December 19, 2022 21:05

# [Choice] GHC version: recommended, latest, 9.2, 9.0, 8.10, 8.8, 8.6
ARG GHC_VERSION="${templateOption:ghcVersion}"
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | GHCUP_CURL_OPTS="-k" sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set BOOTSTRAP_HASKELL_GHC_VERSION to install a specific GHC version.

You probably also want BOOTSTRAP_HASKELL_NONINTERACTIVE=1.

For a full list of env vars affecting the bootstrap, see https://github.com/haskell/ghcup-hs/blob/master/scripts/bootstrap/bootstrap-haskell#L7

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, fantastic, thank you. Exactly what I wanted. Updating my PR now.

Added some bootstrap variables:

* non interactive installation
* ghc version dictated by the devcontainer template
* cabal version defined explicitly

Unfortunately, no option to define cabal and hls versions explicitly.
ENV GHCUP_CURL_OPTS="-k"
ENV BOOTSTRAP_HASKELL_NONINTERACTIVE="1"
ENV BOOTSTRAP_HASKELL_GHC_VERSION="$GHC_VERSION"
ENV BOOTSTRAP_HASKELL_CABAL_VERSION="recommended"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some bootstrap variables:

  • non interactive installation
  • ghc version dictated by the devcontainer template
  • cabal version defined explicitly

Unfortunately, no option to define cabal and hls versions explicitly, but in the previous version of the dockerfile those were defaulted to recommended anyway.

@eitsupi
Copy link
Contributor

eitsupi commented Mar 11, 2023

Cross ref devcontainers/features#470

@Juancanico5
Copy link

Proponiendo una nueva versión de este dockerfile como la actual:

  • no funciona en las nuevas máquinas de silicona de Apple
  • o en máquinas corporativas donde las certificaciones ssl detienen la instalación de ghcup.

El dockerfile se simplifica un poco siguiendo las instrucciones oficiales de instalación de ghcup + el script de instalación se complementa con GHCUP_CURL_OPTSuna variable que maneja los certificados SSL problemáticos (¡mejores soluciones para esta bienvenida!). Gracias.@hasufellpor sugerir usar las variables de arranque (por ejemplo, versión ghc).

Problemas vinculados que comencé recientemente:

Puedo confirmar que esto funciona en una MacBook pro M1 y espero que los contenedores de desarrollo de la comunidad para Haskell comiencen a admitir esa plataforma pronto.

vscode ➜ /workspaces/haskell-community $ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.5
vscode ➜ /workspaces/haskell-community $ ghci
GHCi, version 9.2.5: https://www.haskell.org/ghc/  :? for help
ghci> let a=2+2
ghci> a
4
ghci> 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants