Skip to content

Commit

Permalink
Workspace: Add support for challenge-provided code extensions (#620)
Browse files Browse the repository at this point in the history
* Added an alternative location for external vscode extensions.

* Update code.nix

---------

Co-authored-by: Connor Nelson <Connor@ConnorNelson.com>
  • Loading branch information
etrickel and ConnorNelson authored Nov 11, 2024
1 parent e379d22 commit 9c1cf38
Showing 1 changed file with 12 additions and 4 deletions.
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

0 comments on commit 9c1cf38

Please sign in to comment.