Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: install Haskell libraries (#584) #600

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/haskell/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Haskell (via ghcup)",
"id": "haskell",
"version": "2.2.1",
"version": "2.2.2",
"description": "Installs Haskell. An advanced, purely functional programming language",
"documentationURL": "https://github.com/devcontainers-contrib/features/tree/main/src/haskell",
"options": {
Expand Down Expand Up @@ -31,11 +31,20 @@
"proposals": [
"",
"hlint",
"hlint hspec pandoc"
"hlint pandoc-cli"
Copy link
Author

Choose a reason for hiding this comment

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

According to the pandoc documentation you should install the cabal package pandoc-cli instead of pandoc

],
"default": "",
"description": "Packages to install via `cabal install`, such as `hlint` for linting. Separate with spaces. This will add significant initial build time."
},
"globalLibraries": {
"type": "string",
"proposals": [
"",
"hspec hspec-contrib"
],
"default": "",
"description": "Libraries to install via `cabal install --lib`, such as `hspec` for testing. Separate with spaces. This will add significant initial build time."
},
"installHLS": {
"type": "boolean",
"default": true,
Expand Down
12 changes: 10 additions & 2 deletions src/haskell/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ADJUST_BASHRC="${ADJUSTBASH:-"true"}"

INSTALL_STACK_GHCUP_HOOK="${INSTALLSTACKGHCUPHOOK:-"true"}"
CABAL_INSTALLS=`echo "${GLOBALPACKAGES:-""}" | tr ',' ' '`
CABAL_INSTALLS_LIBS=`echo "${GLOBALLIBRARIES:-""}" | tr ',' ' '`

# Clean up
rm -rf /var/lib/apt/lists/*
Expand Down Expand Up @@ -85,8 +86,15 @@ sudo -iu "$_REMOTE_USER" <<EOF
fi
fi

if [[ ! -z "${CABAL_INSTALLS}" ]]; then
cabal update && echo "${CABAL_INSTALLS}" | xargs cabal install
# Install packages & libraries with Cabal
if [[ -n "${CABAL_INSTALLS}${CABAL_INSTALLS_LIBS}" ]]; then
cabal update
if [[ -n "${CABAL_INSTALLS}" ]]; then
echo "${CABAL_INSTALLS}" | xargs cabal install
fi
if [[ -n "${CABAL_INSTALLS_LIBS}" ]]; then
echo "${CABAL_INSTALLS_LIBS}" | xargs cabal install --lib
fi
fi
EOF

Expand Down