about summary refs log tree commit diff
path: root/pkgs/misc/vscode-extensions/remote-ssh/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/misc/vscode-extensions/remote-ssh/default.nix')
-rw-r--r--pkgs/misc/vscode-extensions/remote-ssh/default.nix16
1 files changed, 9 insertions, 7 deletions
diff --git a/pkgs/misc/vscode-extensions/remote-ssh/default.nix b/pkgs/misc/vscode-extensions/remote-ssh/default.nix
index c6750a6c94ec..fe053dd7ea3d 100644
--- a/pkgs/misc/vscode-extensions/remote-ssh/default.nix
+++ b/pkgs/misc/vscode-extensions/remote-ssh/default.nix
@@ -9,21 +9,23 @@ let
   inherit (vscode-utils) buildVscodeMarketplaceExtension;
   
   # patch runs on remote machine hence use of which
+  # links to local node if version is 12
   patch = ''
     f="/home/''$USER/.vscode-server/bin/''$COMMIT_ID/node"
-    nodePath=''$(which node)
-    if [ -x "''$nodePath" ]; then
-      nodeVersion=''$(node -v)
-      if [[ "${nodeVersion:1:2}" == "12" ]]; then
-        echo PATCH: replacing ''$f with ''$nodePath
+    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 ''$nodePath ''$f
+        ln -s ''$localNodePath ''$f
       fi
     fi
     ${stdenv.lib.optionalString useLocalExtensions ''
       # Use local extensions
-      if test -f "~/.vscode/extensions"; then
+      if [ -d ~/.vscode/extensions ]; then
         if ! test -L "~/.vscode-server/extensions"; then
+          mkdir -p ~/.vscode-server
           ln -s ~/.vscode/extensions ~/.vscode-server/
         fi
       fi