2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, vscode-utils
|
|
|
|
, useLocalExtensions ? false}:
|
|
|
|
# Note that useLocalExtensions requires that vscode-server is not running
|
2021-05-20 23:08:51 +00:00
|
|
|
# on host. If it is, you'll need to remove $HOME/.vscode-server,
|
2020-04-24 23:36:52 +00:00
|
|
|
# and redo the install by running "Connect to host" on client
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (vscode-utils) buildVscodeMarketplaceExtension;
|
|
|
|
|
|
|
|
# patch runs on remote machine hence use of which
|
|
|
|
# links to local node if version is 12
|
|
|
|
patch = ''
|
2021-05-20 23:08:51 +00:00
|
|
|
f="$HOME/.vscode-server/bin/$COMMIT_ID/node"
|
2020-04-24 23:36:52 +00:00
|
|
|
localNodePath=''$(which node)
|
|
|
|
if [ -x "''$localNodePath" ]; then
|
|
|
|
localNodeVersion=''$(node -v)
|
|
|
|
if [ "\''${localNodeVersion:1:2}" = "12" ]; then
|
|
|
|
echo PATCH: replacing ''$f with ''$localNodePath
|
|
|
|
rm ''$f
|
|
|
|
ln -s ''$localNodePath ''$f
|
|
|
|
fi
|
|
|
|
fi
|
2021-01-17 00:15:33 +00:00
|
|
|
${lib.optionalString useLocalExtensions ''
|
2020-04-24 23:36:52 +00:00
|
|
|
# Use local extensions
|
2021-05-20 23:08:51 +00:00
|
|
|
if [ -d $HOME/.vscode/extensions ]; then
|
|
|
|
if ! test -L "$HOME/.vscode-server/extensions"; then
|
|
|
|
mkdir -p $HOME/.vscode-server
|
|
|
|
ln -s $HOME/.vscode/extensions $HOME/.vscode-server/
|
2020-04-24 23:36:52 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
''}
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
buildVscodeMarketplaceExtension {
|
|
|
|
mktplcRef = {
|
|
|
|
name = "remote-ssh";
|
|
|
|
publisher = "ms-vscode-remote";
|
2021-08-05 21:33:18 +00:00
|
|
|
version = "0.65.7";
|
|
|
|
sha256 = "ae86c4be79fc5af747bb1f1aa5841221af80ee7476cc2f1c9ac277fa2fa1d683";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace "out/extension.js" \
|
|
|
|
--replace "# install extensions" '${patch}'
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description ="Use any remote machine with a SSH server as your development environment.";
|
|
|
|
license = licenses.unfree;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
tbenst
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|