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

Workspace: Add support for challenge-provided code extensions #620

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Changes from all commits
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
16 changes: 12 additions & 4 deletions workspace/services/code.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,21 @@ let

until [ -f /run/dojo/var/ready ]; do sleep 0.1; done


if [ -d /run/challenge/share/code/extensions ]; then
EXTENSIONS_DIR="/run/challenge/share/code/extensions"
else
EXTENSIONS_DIR="@out@/share/code/extensions"
fi

${service}/bin/dojo-service start code-service/code-server \
${code-server}/bin/code-server \
--auth=none \
--bind-addr=0.0.0.0:8080 \
--trusted-origins='*' \
--disable-telemetry \
--extensions-dir=@out@/share/code-service/extensions
--extensions-dir=$EXTENSIONS_DIR


until ${pkgs.curl}/bin/curl -s localhost:8080 >/dev/null; do sleep 0.1; done
'';
Expand All @@ -77,16 +85,16 @@ in pkgs.stdenv.mkDerivation {
ln -s ${code-server}/bin/code-server $out/bin/code-server
ln -s ${code-server}/bin/code-server $out/bin/code

mkdir -p $out/share/code-service/extensions
mkdir -p $out/share/code/extensions
${pkgs.wget}/bin/wget -P $NIX_BUILD_TOP 'https://github.com/microsoft/vscode-cpptools/releases/download/v1.20.5/cpptools-linux.vsix'
export HOME=$NIX_BUILD_TOP
${code-server}/bin/code-server \
--auth=none \
--disable-telemetry \
--extensions-dir=$out/share/code-service/extensions \
--extensions-dir=$out/share/code/extensions \
--install-extension ms-python.python \
--install-extension $NIX_BUILD_TOP/cpptools-linux.vsix
chmod +x $out/share/code-service/extensions/ms-vscode.cpptools-*/{bin/cpptools*,bin/libc.so,debugAdapters/bin/OpenDebugAD7,LLVM/bin/clang-*}
chmod +x $out/share/code/extensions/ms-vscode.cpptools-*/{bin/cpptools*,bin/libc.so,debugAdapters/bin/OpenDebugAD7,LLVM/bin/clang-*}

runHook postInstall
'';
Expand Down
Loading