Skip to content

Commit 0a5cefb

Browse files
authored
Improve devshell welcome message in GitHub Codespace (#147)
1 parent fec2153 commit 0a5cefb

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ RUN mkdir -p /usr/local/bin/ \
4848
PROJECT_DIR=\$(find /workspaces/ -mindepth 1 -maxdepth 1 -type d ! -name '.*' -print -quit)
4949
if [ -n "\$PROJECT_DIR" ]; then
5050
pushd \$PROJECT_DIR > /dev/null
51+
# HLS error (Couldn't load cradle for ghc libdir) if `cabal update` has never been run in project using cardano-haskell-packages ...
52+
echo "Running `cabal update` ..."
53+
bash -ic "cabal update"
5154
# GitHub Codespaces should have \$GITHUB_TOKEN already set.
5255
if [ -n "\$GITHUB_TOKEN" ]; then
5356
echo \$GITHUB_TOKEN | gh auth login --with-token
@@ -59,9 +62,6 @@ if [ -n "\$PROJECT_DIR" ]; then
5962
else
6063
echo "\\\$GITHUB_TOKEN is not set. Skipping HLS cache download."
6164
fi
62-
# HLS error (Couldn't load cradle for ghc libdir) if `cabal update` has never been run in project using cardano-haskell-packages ...
63-
echo "Running `cabal update` ..."
64-
bash -c "cabal update"
6565
popd > /dev/null
6666
fi
6767
EOF

quirks.nix

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,19 @@
2222
'';
2323
hint = flavor: ''
2424
if [ "$GITHUB_ACTIONS" = "true" ]; then
25-
echo "::notice::Hint: to reproduce this environment locally, use either:" \
26-
"\`nix develop github:input-output-hk/devx#${flavor}\`, or" \
27-
"\`docker run -it -v \$(pwd):/workspaces ghcr.io/input-output-hk/devx-devcontainer:x86_64-linux.${flavor}\`"
25+
PREFIX="::notice::Hint:"
26+
else
27+
PREFIX="Hint:"
28+
fi
29+
if [ "$GITHUB_ACTIONS" = "true" ] || [ -n "$CODESPACE_TOKEN" ]; then
30+
echo "$PREFIX to reproduce this environment locally, use either:" \
31+
"\`nix develop github:input-output-hk/devx#${flavor}\`, or" \
32+
"\`docker run -it -v \$(pwd):/workspaces ghcr.io/input-output-hk/devx-devcontainer:x86_64-linux.${flavor}\`"
33+
fi
34+
if [ -n "$CODESPACE_TOKEN" ]; then
35+
echo "Quirks:"
36+
echo -e "\tThe Haskell VSCode extension might ask you \"How do you want the extension to manage/discover HLS and the relevant toolchain?\""
37+
echo -e "\tChoose \"Manually via PATH\", not \"Automatically via GHCup\""
2838
fi
2939
'';
30-
}
40+
}

0 commit comments

Comments
 (0)