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?

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!