mirror of
https://github.com/input-output-hk/devx.git
synced 2024-09-11 04:15:30 +03:00
Improve devshell welcome message in GitHub Codespace (#147)
This commit is contained in:
parent
fec21531a5
commit
0a5cefb55c
@ -48,6 +48,9 @@ RUN mkdir -p /usr/local/bin/ \
|
||||
PROJECT_DIR=\$(find /workspaces/ -mindepth 1 -maxdepth 1 -type d ! -name '.*' -print -quit)
|
||||
if [ -n "\$PROJECT_DIR" ]; then
|
||||
pushd \$PROJECT_DIR > /dev/null
|
||||
# HLS error (Couldn't load cradle for ghc libdir) if `cabal update` has never been run in project using cardano-haskell-packages ...
|
||||
echo "Running `cabal update` ..."
|
||||
bash -ic "cabal update"
|
||||
# GitHub Codespaces should have \$GITHUB_TOKEN already set.
|
||||
if [ -n "\$GITHUB_TOKEN" ]; then
|
||||
echo \$GITHUB_TOKEN | gh auth login --with-token
|
||||
@ -59,9 +62,6 @@ if [ -n "\$PROJECT_DIR" ]; then
|
||||
else
|
||||
echo "\\\$GITHUB_TOKEN is not set. Skipping HLS cache download."
|
||||
fi
|
||||
# HLS error (Couldn't load cradle for ghc libdir) if `cabal update` has never been run in project using cardano-haskell-packages ...
|
||||
echo "Running `cabal update` ..."
|
||||
bash -c "cabal update"
|
||||
popd > /dev/null
|
||||
fi
|
||||
EOF
|
||||
|
18
quirks.nix
18
quirks.nix
@ -22,9 +22,19 @@
|
||||
'';
|
||||
hint = flavor: ''
|
||||
if [ "$GITHUB_ACTIONS" = "true" ]; then
|
||||
echo "::notice::Hint: to reproduce this environment locally, use either:" \
|
||||
"\`nix develop github:input-output-hk/devx#${flavor}\`, or" \
|
||||
"\`docker run -it -v \$(pwd):/workspaces ghcr.io/input-output-hk/devx-devcontainer:x86_64-linux.${flavor}\`"
|
||||
PREFIX="::notice::Hint:"
|
||||
else
|
||||
PREFIX="Hint:"
|
||||
fi
|
||||
if [ "$GITHUB_ACTIONS" = "true" ] || [ -n "$CODESPACE_TOKEN" ]; then
|
||||
echo "$PREFIX to reproduce this environment locally, use either:" \
|
||||
"\`nix develop github:input-output-hk/devx#${flavor}\`, or" \
|
||||
"\`docker run -it -v \$(pwd):/workspaces ghcr.io/input-output-hk/devx-devcontainer:x86_64-linux.${flavor}\`"
|
||||
fi
|
||||
if [ -n "$CODESPACE_TOKEN" ]; then
|
||||
echo "Quirks:"
|
||||
echo -e "\tThe Haskell VSCode extension might ask you \"How do you want the extension to manage/discover HLS and the relevant toolchain?\""
|
||||
echo -e "\tChoose \"Manually via PATH\", not \"Automatically via GHCup\""
|
||||
fi
|
||||
'';
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user