diff --git a/README.org b/README.org index 7bb4fc1..d6dda97 100644 --- a/README.org +++ b/README.org @@ -502,6 +502,7 @@ nixos = nixpkgs.lib.nixosSystem { <> <> <> + <> <> <> <> @@ -733,6 +734,29 @@ in { } #+END_SRC +** Godot + +#+NAME: module-godot +#+BEGIN_SRC nix +./modules/godot.nix +#+END_SRC + +[[https://godotengine.org][Godot]] is a cross-platform, free and open-source game engine released under the MIT license. It provides a huge set of common tools, so you can focus on making your game without reinventing the wheel. It's completely free and open-source, no strings attached, no royalties. The game belongs to the creator down to each line of the engine code. + +#+BEGIN_SRC nix :noweb yes :tangle modules/godot.nix +# <> +{ config, pkgs, ... }: + +{ + environment.systemPackages = [ + tiled + godot + godot-server + godot-headless + ]; +} +#+END_SRC + ** Flakes #+NAME: module-flakes @@ -1108,6 +1132,7 @@ let <> <> <> + <> <> <> <> @@ -1188,6 +1213,7 @@ When Emacs is started, it normally tries to load a Lisp program from an ititiali <> <> <> +<> <> <> <> @@ -2353,7 +2379,8 @@ The [[https://microsoft.github.io/language-server-protocol][Language Server Prot ;; Add custom keybindings for `lsp'. (dotfiles/leader - "tl" '(lsp :which-key "LSP")) + "l" '(:ignore t :which-key "LSP") + "ll" '(lsp :which-key "LSP")) #+END_SRC ** CCLS @@ -2398,6 +2425,48 @@ epkgs.company (global-company-mode +1) #+END_SRC +** GDScript Mode + +#+NAME: emacs-gdscript-package +#+BEGIN_SRC nix +epkgs.gdscript-mode +#+END_SRC + +https://github.com/godotengine/emacs-gdscript-mode is an Emacs package to get GDScript support and syntax highlighting. Some of its features include: + ++ Syntax highlighting ++ Code folding ++ Debugger support ++ Support for scenes and script files ++ Comment wrapping ++ Indentation ++ Automatic parsing ++ Code formatting + +#+NAME: emacs-gdscript-elisp +#+BEGIN_SRC emacs-lisp +(require 'gdscript-mode) + +;; Silence lsp warnings for gdscript. +(defun lsp--gdscript-ignore-errors (original-function &rest args) + "Ignore the error message resulting from Godot not replying to the `JSONRPC' request." + (if (string-equal major-mode "gdscript-mode") + (let ((json-data (nth 0 args))) + (if (and (string= (gethash "jsonrpc" json-data "") "2.0") + (not (gethash "id" json-data nil)) + (not (gethash "method" json-data nil))) + nil; (message "Method not found") + (apply original-function args))) + (apply original-function args))) + +;; Run the function around `lsp--get-message-type' to suppress warnings. +(advice-add #'lsp--get-message-type :around #'lsp--gdscript-ignore-errors) + +;; Add custom keybinds. +(dotfiles/leader + "lg" '(gdscript-hydra-show :which-key "GDScript")) +#+END_SRC + ** Go Mode #+NAME: emacs-golang-package diff --git a/flake.lock b/flake.lock index 0440fc6..804dd92 100644 --- a/flake.lock +++ b/flake.lock @@ -30,6 +30,21 @@ "type": "github" } }, + "flake-utils_2": { + "locked": { + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -73,7 +88,7 @@ }, "nix-on-droid": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "home-manager": "home-manager_2", "nixpkgs": [ "nixpkgs" @@ -142,6 +157,7 @@ "root": { "inputs": { "emacs-overlay": "emacs-overlay", + "flake-utils": "flake-utils", "home-manager": "home-manager", "nix-on-droid": "nix-on-droid", "nixos-hardware": "nixos-hardware", diff --git a/flake.nix b/flake.nix index 0b7af8a..f823780 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,7 @@ ./modules/x11.nix ./modules/ssh.nix ./modules/hugo.nix + ./modules/godot.nix ./modules/flakes.nix ./modules/cachix.nix ./modules/firefox.nix diff --git a/modules/emacs.nix b/modules/emacs.nix index 0f9dc00..a5032e4 100644 --- a/modules/emacs.nix +++ b/modules/emacs.nix @@ -48,6 +48,7 @@ let epkgs.lsp-mode epkgs.lsp-ui epkgs.company + epkgs.gdscript-mode epkgs.ccls epkgs.go-mode epkgs.pretty-mode diff --git a/modules/godot.nix b/modules/godot.nix new file mode 100644 index 0000000..20b68f6 --- /dev/null +++ b/modules/godot.nix @@ -0,0 +1,11 @@ +# This file is controlled by /etc/dotfiles/README.org +{ config, pkgs, ... }: + +{ + environment.systemPackages = [ + tiled + godot + godot-server + godot-headless + ]; +}