Dafny vscode extension fails to start

I was following the nixos wiki to install dafny vscode extension using extensionsFromVscodeMarketplace.

The first time the extension is run it tries to install the dafny compiler but is not able to create the out directory since it is read-only.

What is the correct way to handle extensions that try to install extra tooling?

1 Like

Welcome to NixOS ! :slight_smile:

Let’s assume the extension actually does a check to see if the compiler is available. In that case, providing it with the compiler in the environment you are running the extension might solve the issue.

So maybe try adding the dafny compiler to your system? Or run the whole combination inside a nix shell?

Other than that, if I see correctly, these VSCode extensions use stdenv.mkDerivation just like other normal derivations would. There you could provide a list of buildInputs which should be available at runtime. In your case the dafny compiler.

Hi sorry for the delay, I was able to get it to work by using vscode.fhs.

Thank you @APCodes for the ideas and points. Dafny’s extension is not in nixpkgs, but maybe that could get me to jump in and learn how to package.

I didn’t try to link dafny’s compiler from the system, will try and will update.

Yes, once you got it working for yourself it would be nice to contribute it upstream, if you have the time to do so, I agree!

I’m facing the same problem. Can you share the relevant parts of your configuration.nix or of your nix-shell invocation or however you got it to work?

Currently in my configurations i just have the following without my other packages included for brevity:

environment.systemPackages = with pkgs; [ vscode.fhs ];

I do have a home module I was trying to setup that I did not get to. This is making it system-wide so I am guessing you can try nix-shell -p vscode.fhs, if you just want it temporary.