VSCode Remote SSH on NixOS: "Could not start dynamically linked executable" Error

I am using NixOS as my home development server to take advantage of its greater build power. I want to use the Remote SSH feature in VSCode, and my current NixOS configuration looks like this:

 # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
       ....

	vscode
	(vscode-with-extensions.override {
    		vscodeExtensions = with vscode-extensions; [
      			ms-vscode-remote.remote-ssh
    		];
  	})
  ];

However, I’m encountering the following error in NixOS:

how I can fix this "➜  ~ .vscode-server/cli/servers/Stable-384ff7382de624fb94dbaf6da11977bba1ecd427.staging/server/bin/code-server --version
Could not start dynamically linked executable: /home/vincenzopalazzo/.vscode-server/cli/servers/Stable-384ff7382de624fb94dbaf6da11977bba1ecd427.staging/server/node
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld"

Does anyone know how to fix this error? Has anyone successfully resolved this issue before?

Hello,

have you tried one of the solutions at Visual Studio Code - NixOS Wiki ?

Thanks for poining me to this side.

I read all and I found the solution with

diff --git a/nix/configuration.nix b/nix/configuration.nix
index 0e561b4..b883d32 100644
--- a/nix/configuration.nix
+++ b/nix/configuration.nix

   # Allow unfree packages
   nixpkgs.config.allowUnfree = true;

+  # See https://nixos.wiki/wiki/Visual_Studio_Code#Remote_SSH
+  programs.nix-ld.enable = true;
   # List packages installed in system profile. To search, run:
   # $ nix search wget
   environment.systemPackages = with pkgs; [
@@ -166,6 +167,23 @@
     gettext

     ncurses
+
+    vscode
+    vscode.fhs
+    (vscode-with-extensions.override {
+      vscodeExtensions = with vscode-extensions;
+        [
+          bbenoist.nix
+          ms-python.python
+          ms-azuretools.vscode-docker
+          ms-vscode-remote.remote-ssh
+        ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [{
+          name = "remote-ssh-edit";
+          publisher = "ms-vscode-remote";
+          version = "0.47.2";
+          sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g";
+        }];
+    })
   ];
1 Like