2021-01-25 08:26:54 +00:00
|
|
|
{ lib
|
2019-12-23 01:45:43 +00:00
|
|
|
, vscode-utils
|
|
|
|
, useLocalExtensions ? false}:
|
|
|
|
# Note that useLocalExtensions requires that vscode-server is not running
|
2021-05-18 02:06:56 +01:00
|
|
|
# on host. If it is, you'll need to remove $HOME/.vscode-server,
|
2019-12-23 01:45:43 +00:00
|
|
|
# and redo the install by running "Connect to host" on client
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (vscode-utils) buildVscodeMarketplaceExtension;
|
2020-03-13 13:00:48 +00:00
|
|
|
|
2019-12-23 01:45:43 +00:00
|
|
|
# patch runs on remote machine hence use of which
|
2019-12-25 10:32:23 +00:00
|
|
|
# links to local node if version is 12
|
2019-12-23 01:45:43 +00:00
|
|
|
patch = ''
|
2021-05-18 02:06:56 +01:00
|
|
|
f="$HOME/.vscode-server/bin/$COMMIT_ID/node"
|
2019-12-25 10:32:23 +00:00
|
|
|
localNodePath=''$(which node)
|
|
|
|
if [ -x "''$localNodePath" ]; then
|
|
|
|
localNodeVersion=''$(node -v)
|
|
|
|
if [ "\''${localNodeVersion:1:2}" = "12" ]; then
|
|
|
|
echo PATCH: replacing ''$f with ''$localNodePath
|
2019-12-23 01:45:43 +00:00
|
|
|
rm ''$f
|
2019-12-25 10:32:23 +00:00
|
|
|
ln -s ''$localNodePath ''$f
|
2019-12-23 01:45:43 +00:00
|
|
|
fi
|
|
|
|
fi
|
2021-01-15 13:21:58 +00:00
|
|
|
${lib.optionalString useLocalExtensions ''
|
2019-12-23 01:45:43 +00:00
|
|
|
# Use local extensions
|
2021-05-18 02:06:56 +01: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/
|
2019-12-23 01:45:43 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
''}
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
buildVscodeMarketplaceExtension {
|
|
|
|
mktplcRef = {
|
|
|
|
name = "remote-ssh";
|
|
|
|
publisher = "ms-vscode-remote";
|
2021-07-28 07:53:48 +01:00
|
|
|
version = "0.65.7";
|
|
|
|
sha256 = "ae86c4be79fc5af747bb1f1aa5841221af80ee7476cc2f1c9ac277fa2fa1d683";
|
2019-12-23 01:45:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace "out/extension.js" \
|
|
|
|
--replace "# install extensions" '${patch}'
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-12-23 01:45:43 +00:00
|
|
|
description ="Use any remote machine with a SSH server as your development environment.";
|
|
|
|
license = licenses.unfree;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
tbenst
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|