Godot-Mono
Godot-Mono is Godot's game engine supporting C# language for creating both 2D and 3D games.
Installation
Add pkgs.godot-mono (GDScript + C#) to environment.systemPackages.
Export Templates
On Godot upgrade, the new export template version can be automatically provisioned this way:
home.file.".local/share/godot/export_templates/${builtins.replaceStrings [ "-" ] [ "." ] pkgs.godot-mono_4-export-templates.version}".source = pkgs.godot-mono_4-export-templates;
Note: `pkgs.godot-mono_4-export-templates` package is still pending in nixpkgs.
Configuring VSCode Editor for Godot-Mono (C#)
As Godot editor has poor support for C#, VSCode editor is recommended.
Install and configure VSCode as such:
programs.vscode = {
enable = true;
package = pkgs.codium;
profiles.default = {
"godotTools.lsp.serverPort" = 6005; # port should match your Godot configuration
"dotnetAcquisitionExtension.sharedExistingDotnetPath" = "${pkgs.dotnet-sdk_8}/bin/dotnet";
"dotnetAcquisitionExtension.existingDotnetPath" = [
{
"extensionId" = "ms-dotnettools.csharp";
"path" = "${pkgs.dotnet-sdk_8}/bin/dotnet";
}
{
"extensionId" = "ms-dotnettools.csdevkit";
"path" = "${pkgs.dotnet-sdk_8}/bin/dotnet";
}
];
extensions = with pkgs.vscode-extensions; [
geequlim.godot-tools # For Godot GDScript
ms-dotnettools.csdevkit
ms-dotnettools.csharp
ms-dotnettools.vscode-dotnet-runtime
];
};
Configure Godot's Editor → Editor Settings menu:
- Set Dotnet -> Editor -> External Editor to Visual Studio Code.
Configure Godot 4 for External VSCode Integration
Click Editor [top menu] -> Editor Settings [menu item] -> General [Tab] -> Text Editor [Category] -> External [Sub-Category]:
- Exec Path -> Add the output of
which codium, on my case would be:/etc/profiles/per-user/REPLACE-USERNAME/bin/codium - Exec Flags ->
{project} --goto {file}:{line}:{col} - Use External Editor ->
On