feat(plugins,nix): godot integration
This commit is contained in:
13
flake.lock
generated
13
flake.lock
generated
@@ -1,5 +1,17 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"godotdev": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"narHash": "sha256-q8Ej78SeZkVt5LxLdJJopVYY1qFdKaObkmZzwJFv1cE=",
|
||||||
|
"type": "file",
|
||||||
|
"url": "file:///home/guz/.projects/guz013-godotdev-nvim"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "file",
|
||||||
|
"url": "file:///home/guz/.projects/guz013-godotdev-nvim"
|
||||||
|
}
|
||||||
|
},
|
||||||
"mdfmt": {
|
"mdfmt": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -34,6 +46,7 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"godotdev": "godotdev",
|
||||||
"mdfmt": "mdfmt",
|
"mdfmt": "mdfmt",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
|
|||||||
97
flake.nix
97
flake.nix
@@ -6,6 +6,12 @@
|
|||||||
url = "github:moorereason/mdfmt";
|
url = "github:moorereason/mdfmt";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
godotdev = {
|
||||||
|
# url = "github:Mathijs-Bakker/godotdev.nvim";
|
||||||
|
url = "git+file:///home/guz/.projects/guz013-godotdev-nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
outputs = {
|
outputs = {
|
||||||
self,
|
self,
|
||||||
@@ -41,10 +47,87 @@
|
|||||||
}: {
|
}: {
|
||||||
neovim = pkgs.callPackage ./package.nix {
|
neovim = pkgs.callPackage ./package.nix {
|
||||||
mdfmt = self.packages.${pkgs.system}.mdfmt;
|
mdfmt = self.packages.${pkgs.system}.mdfmt;
|
||||||
|
godotdev = self.packages.${pkgs.system}.godotdev;
|
||||||
};
|
};
|
||||||
godot-neovim = pkgs.writeShellApplication {
|
godotdev = pkgs.vimUtils.buildVimPlugin {
|
||||||
name = "godot-neovim";
|
pname = "godotdev.nvim";
|
||||||
|
version = "v0.2.3";
|
||||||
|
src = inputs.godotdev;
|
||||||
|
};
|
||||||
|
gh-actions-language-server = pkgs.callPackage ({
|
||||||
|
stdenv,
|
||||||
|
lib,
|
||||||
|
makeBinaryWrapper,
|
||||||
|
buildNpmPackage,
|
||||||
|
bun,
|
||||||
|
nodejs,
|
||||||
|
npmHooks,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
pname = "gh-actions-language-server";
|
||||||
|
src = fetchGit {
|
||||||
|
url = "https://github.com/lttb/gh-actions-language-server";
|
||||||
|
rev = "0287d3081d7b74fef88824ca3bd6e9a44323a54d";
|
||||||
};
|
};
|
||||||
|
packageJson = lib.importJSON "${src}/package.json";
|
||||||
|
version = packageJson.version;
|
||||||
|
node_modules = stdenv.mkDerivation {
|
||||||
|
inherit src version;
|
||||||
|
pname = "${pname}-node_modules";
|
||||||
|
nativeBuildInputs = [bun];
|
||||||
|
dontConfigure = true;
|
||||||
|
buildPhase = ''
|
||||||
|
bun install --no-progress --frozen-lockfile
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/node_modules
|
||||||
|
cp -R ./node_modules/* $out/node_modules
|
||||||
|
ls -la $out/node_modules
|
||||||
|
'';
|
||||||
|
dontFixup = true;
|
||||||
|
dontPathShebangs = true;
|
||||||
|
outputHash = "sha256-HfMP9OI07CpiOQw5xkpcRPKPv/MflU1FjtSMOuCkYtg=";
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
inherit pname src version;
|
||||||
|
buildInputs = [bun nodejs];
|
||||||
|
nativeBuildInputs = [makeBinaryWrapper];
|
||||||
|
|
||||||
|
dontConfigure = true;
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
ln -s "${node_modules}/node_modules" ./
|
||||||
|
bun run build:node
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out
|
||||||
|
mv ./bin/$pname $out/$pname
|
||||||
|
makeBinaryWrapper ${lib.getExe nodejs} $out/bin/$pname \
|
||||||
|
--prefix PATH : ${lib.makeBinPath [nodejs]} \
|
||||||
|
--add-flags "$out/$pname"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
# installPhase = ''
|
||||||
|
# runHook preInstall
|
||||||
|
#
|
||||||
|
# mkdir -p $out/bin
|
||||||
|
# makeBinaryWrapper ${lib.getExe nodejs} $out/bin/$pname \
|
||||||
|
# --prefix PATH : "${lib.makeBinPath [nodejs]}"
|
||||||
|
# --add-flags "$out/$pname"
|
||||||
|
#
|
||||||
|
# runHook postInstall
|
||||||
|
# '';
|
||||||
|
}) {};
|
||||||
mdfmt = pkgs.buildGoModule {
|
mdfmt = pkgs.buildGoModule {
|
||||||
name = "mdfmt";
|
name = "mdfmt";
|
||||||
src = inputs.mdfmt;
|
src = inputs.mdfmt;
|
||||||
@@ -90,6 +173,7 @@
|
|||||||
type = with types; bool;
|
type = with types; bool;
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
integrations.godot.enable = mkEnableOption "";
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
@@ -104,6 +188,10 @@
|
|||||||
yazi = config.programs.yazi.package;
|
yazi = config.programs.yazi.package;
|
||||||
}))
|
}))
|
||||||
]
|
]
|
||||||
|
++ (optionals cfg.integrations.godot.enable [
|
||||||
|
self.packages."${pkgs.system}".godot-neovim
|
||||||
|
]);
|
||||||
|
|
||||||
# Disable NixOS's Neovim
|
# Disable NixOS's Neovim
|
||||||
programs.neovim.enable = mkForce false;
|
programs.neovim.enable = mkForce false;
|
||||||
};
|
};
|
||||||
@@ -136,6 +224,7 @@
|
|||||||
type = with types; bool;
|
type = with types; bool;
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
integrations.godot.enable = mkEnableOption "";
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
@@ -151,6 +240,10 @@
|
|||||||
yazi = config.programs.yazi.package;
|
yazi = config.programs.yazi.package;
|
||||||
}))
|
}))
|
||||||
]
|
]
|
||||||
|
++ (optionals cfg.integrations.godot.enable [
|
||||||
|
self.packages."${pkgs.system}".godot-neovim
|
||||||
|
]);
|
||||||
|
|
||||||
programs.bash.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
|
programs.bash.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
|
||||||
programs.fish.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
|
programs.fish.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
|
||||||
programs.zsh.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
|
programs.zsh.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ lze.load({
|
|||||||
-- Language Server Protocol
|
-- Language Server Protocol
|
||||||
{
|
{
|
||||||
"nvim-lspconfig",
|
"nvim-lspconfig",
|
||||||
|
dep_of = { "godotdev" },
|
||||||
---@param plugin lze.Plugin
|
---@param plugin lze.Plugin
|
||||||
lsp = function(plugin)
|
lsp = function(plugin)
|
||||||
local config = plugin.lsp or {}
|
local config = plugin.lsp or {}
|
||||||
@@ -27,6 +28,7 @@ lze.load({
|
|||||||
after = function()
|
after = function()
|
||||||
require("dot.debugger")
|
require("dot.debugger")
|
||||||
end,
|
end,
|
||||||
|
dep_of = { "godotdev.nvim" },
|
||||||
on_require = { "dap", "dapui" },
|
on_require = { "dap", "dapui" },
|
||||||
},
|
},
|
||||||
{ "nvim-dap-ui", dep_of = "nvim-dap" },
|
{ "nvim-dap-ui", dep_of = "nvim-dap" },
|
||||||
@@ -180,7 +182,7 @@ lze.load({
|
|||||||
-- Treesitter (Syntax Highlighting)
|
-- Treesitter (Syntax Highlighting)
|
||||||
{
|
{
|
||||||
"nvim-treesitter",
|
"nvim-treesitter",
|
||||||
dep_of = "indent-blankline.nvim",
|
dep_of = { "godotdev", "indent-blankline.nvim" },
|
||||||
on_require = "nvim-treesitter",
|
on_require = "nvim-treesitter",
|
||||||
},
|
},
|
||||||
{ "nvim-treesitter-textobjects", dep_of = "nvim-treesitter" },
|
{ "nvim-treesitter-textobjects", dep_of = "nvim-treesitter" },
|
||||||
@@ -249,7 +251,14 @@ lze.load({
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"godot.nvim",
|
"godotdev.nvim",
|
||||||
cmd = { "GodotDebug", "GodotBreakAtCursor", "GodotStep", "GodotQuit", "GodotContinue" },
|
after = function()
|
||||||
|
require("godotdev").setup({
|
||||||
|
autostart_editor_server = true,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
cmd = { "GodotReconnectLSP", "GodotStartEditorServer" },
|
||||||
|
ft = { "gd", "gdscript", "gdshader", "gdscript3" },
|
||||||
|
on_require = "godotdev",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
19
package.nix
19
package.nix
@@ -4,6 +4,14 @@
|
|||||||
neovim ? pkgs.neovim,
|
neovim ? pkgs.neovim,
|
||||||
mdfmt ? null,
|
mdfmt ? null,
|
||||||
yazi ? pkgs.yazi,
|
yazi ? pkgs.yazi,
|
||||||
|
godotdev ? (pkgs.vimUtils.buildVimPlugin {
|
||||||
|
pname = "godotdev.nvim";
|
||||||
|
version = "v0.2.3";
|
||||||
|
src = fetchGit {
|
||||||
|
url = "https://github.com/Mathijs-Bakker/godotdev.nvim";
|
||||||
|
rev = "79d9315988b7772c03a1cabb6f31f5287c849e2b";
|
||||||
|
};
|
||||||
|
}),
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
dot-nvim = pkgs.vimUtils.buildVimPlugin {
|
dot-nvim = pkgs.vimUtils.buildVimPlugin {
|
||||||
@@ -86,14 +94,7 @@ in
|
|||||||
rev = "be7b03748f59b6602502baf08e7f7736cc7279a5";
|
rev = "be7b03748f59b6602502baf08e7f7736cc7279a5";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
(pkgs.vimUtils.buildVimPlugin {
|
godotdev
|
||||||
pname = "godot.nvim";
|
|
||||||
version = "v0.4.4";
|
|
||||||
src = fetchGit {
|
|
||||||
url = "https://github.com/Lommix/godot.nvim";
|
|
||||||
rev = "349b6b088c15447843fc21b60ba7267b8b49d821";
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
# inherit start opt;
|
# inherit start opt;
|
||||||
};
|
};
|
||||||
@@ -105,6 +106,7 @@ in
|
|||||||
|
|
||||||
vscode-langservers-extracted # cssls, eslint, html, jsonls, typescript
|
vscode-langservers-extracted # cssls, eslint, html, jsonls, typescript
|
||||||
|
|
||||||
|
docker-language-server
|
||||||
emmet-language-server
|
emmet-language-server
|
||||||
golangci-lint-langserver
|
golangci-lint-langserver
|
||||||
gopls
|
gopls
|
||||||
@@ -115,6 +117,7 @@ in
|
|||||||
nil
|
nil
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
tailwindcss-language-server
|
tailwindcss-language-server
|
||||||
|
typescript-language-server
|
||||||
]
|
]
|
||||||
++ [
|
++ [
|
||||||
# INFO: Formatters
|
# INFO: Formatters
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
# Script provided by Mathijs Bakker's godotdev.nvim, licensed under the Apache
|
# Script provided by Mathijs Bakker's godotdev.nvim, licensed under the Apache
|
||||||
# License Version 2.0.
|
# License Version 2.0.
|
||||||
#
|
#
|
||||||
# A copy of the original script can be found at
|
# A copy of the original script can be found at
|
||||||
# https://github.com/Mathijs-Bakker/godotdev.nvim/blob/79d9315988b7772c03a1cabb6f31f5287c849e2b/doc/neovim-external-editor-setup.md#installation
|
# https://github.com/Mathijs-Bakker/godotdev.nvim/blob/79d9315988b7772c03a1cabb6f31f5287c849e2b/doc/neovim-external-editor-setup.md#installation
|
||||||
#
|
#
|
||||||
# A copy of the original license can be found at
|
# A copy of the original license can be found at
|
||||||
# https://github.com/Mathijs-Bakker/godotdev.nvim/blob/79d9315988b7772c03a1cabb6f31f5287c849e2b/LICENSE
|
# https://github.com/Mathijs-Bakker/godotdev.nvim/blob/79d9315988b7772c03a1cabb6f31f5287c849e2b/LICENSE
|
||||||
|
|
||||||
# Godot → Neovim launcher with GUI terminal focus
|
# Godot → Neovim launcher with GUI terminal focus
|
||||||
@@ -28,8 +28,7 @@ else
|
|||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SOCKET="${SOCKET:=/tmp/godot.pipe}" # Neovim socket path
|
SOCKET="${SOCKET:=/tmp/godot.nvim}" # Neovim socket path
|
||||||
NVR="${NVR:=/Library/Frameworks/Python.framework/Versions/3.8/bin/nvr}"
|
|
||||||
|
|
||||||
OPEN_MODE="window"
|
OPEN_MODE="window"
|
||||||
LINE=""
|
LINE=""
|
||||||
@@ -40,36 +39,47 @@ FILE=""
|
|||||||
# -----------------------------
|
# -----------------------------
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--tab) OPEN_MODE="tab"; shift ;;
|
--tab)
|
||||||
--vsplit) OPEN_MODE="vsplit"; shift ;;
|
OPEN_MODE="tab"
|
||||||
+[0-9]*) LINE="${1#+}"; shift ;;
|
shift
|
||||||
*) FILE="$1"; shift ;;
|
;;
|
||||||
|
--vsplit)
|
||||||
|
OPEN_MODE="vsplit"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
+[0-9]*)
|
||||||
|
LINE="${1#+}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
FILE="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -z "$FILE" ] && exit 0
|
[ "$FILE" = "" ] && exit 0
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Open file in Neovim or jump to buffer
|
# Open file in Neovim or jump to buffer
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
if $NVR --servername "$SOCKET" --remote-expr \
|
if nvr --servername "$SOCKET" --remote-expr \
|
||||||
"bufexists(fnamemodify('$FILE', ':p'))" | grep -q 1; then
|
"bufexists(fnamemodify('$FILE', ':p'))" | grep -q 1; then
|
||||||
CMD=":buffer $(basename "$FILE")"
|
CMD=":buffer $(basename "$FILE")"
|
||||||
else
|
else
|
||||||
case "$OPEN_MODE" in
|
case "$OPEN_MODE" in
|
||||||
window) CMD=":e $FILE" ;;
|
window) CMD=":e $FILE" ;;
|
||||||
tab) CMD=":tabedit $FILE" ;;
|
tab) CMD=":tabedit $FILE" ;;
|
||||||
vsplit) CMD=":vsplit $FILE" ;;
|
vsplit) CMD=":vsplit $FILE" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$LINE" ] && CMD="$CMD | call cursor($LINE,1)"
|
[ "$LINE" != "" ] && CMD="$CMD | call cursor($LINE,1)"
|
||||||
CMD="$CMD | normal! zz"
|
CMD="$CMD | normal! zz"
|
||||||
|
|
||||||
$NVR --servername "$SOCKET" --remote-send "<C-\\><C-N>${CMD}<CR>"
|
nvr --servername "$SOCKET" --remote-send "<C-\\><C-N>${CMD}<CR>"
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Focus GUI terminal (Hyprland)
|
# Focus GUI terminal (Hyprland)
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
hyprctl dispatch focuswindow class:$GODOT_TERMINAL
|
hyprctl dispatch focuswindow "class:$GODOT_TERMINAL"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user