How to install C# dependencies in Vscode?

Hi, I’m new to NixOS.

I’ve installed vscode and the csharp extension using configuration.nix

  environment.systemPackages = with pkgs;
    let
      vscodeWithExtension = vscode-with-extensions.override {
        # When the extension is already available in the default extensions set.
        vscodeExtensions = with vscode-extensions; [
          bbenoist.Nix
        ]
        # Concise version from the vscode market place when not available in the default set.
        ++ vscode-utils.extensionsFromVscodeMarketplace [
          {
            name = "csharp";
            publisher = "ms-vscode";
            version = "1.21.3";
            sha256 = "0qaq8yxyg44192ppslk4ij6nr6bd8cb52fbhx1qdh5v7ljb9ls51";
          }
        ];
      };
    in
      [
        p7zip
        firefox
        myNeovim
        keepassx2
        git
        vscodeWithExtension
        dotnet-sdk
      ];

but when I run Vscode in a folder with a C# project I get

Installing C# dependencies...
Platform: linux, x86_64, name=nixos, version=19.03.173522.021d733ea3f

Failed at stage: touchBeginFile
Error: EROFS: read-only file system, mkdir '/nix/store/awdxvn8ckc29gcnx8iymf363hipmiwyg-vscode-extensions-1.35.1/share/vscode/extensions/ms-vscode.csharp/.omnisharp'

and

Starting OmniSharp server at 9/23/2019, 5:23:18 AM
    Target: /home/jon/projects/Mahjong

[ERROR] Error: spawn /nix/store/awdxvn8ckc29gcnx8iymf363hipmiwyg-vscode-extensions-1.35.1/share/vscode/extensions/ms-vscode.csharp/.omnisharp/1.34.3/run ENOENT

in their respective logs.

Is there a way to make this work?

edit: I see now that the .omnisharp folder doesn’t even exist so I guess that means I need to install it somehow?

1 Like

me too error…
so install just vscode & vscode-with-extensions (without configuration)
and.
ui install extension… download to HOME directory.
but… can’t set unity engine. g,.g.

Unfortunately there’s no way around this with how vscode is currently packaged. If we use a buildFHSUserEnv, then it might be possible because there is a writable directory. There might be a way for telling the plugin to use HOME or something, instead of the installation path.

1 Like