Added Golang support

This commit is contained in:
Fred Drake
2024-10-02 21:30:59 -04:00
parent d8dc1cbd83
commit 50675505f7
5 changed files with 44 additions and 2 deletions
+1 -2
View File
@@ -25,9 +25,8 @@ The default configuration performs editing without settings for any particular l
- Rust `nix run github:fred-drake/neovim#rust` - Rust `nix run github:fred-drake/neovim#rust`
- C# `nix run github:fred-drake/neovim#csharp` - C# `nix run github:fred-drake/neovim#csharp`
- Go `nix run github:fred-drake/neovim#golang`
## Things To Do ## Things To Do
- TODO: Implement DAP for debugging
- TODO: Change fzf to only allow git-level root if applicable - TODO: Change fzf to only allow git-level root if applicable
- TODO: Break up LSP, CMP and Tree-Sitter for lanuages like rust, go, etc.
+6
View File
@@ -0,0 +1,6 @@
{ pkgs, ... }: {
plugins.dap.extensions.dap-go = {
enable = true;
delve.path = "${pkgs.delve}/bin/dlv";
};
}
+16
View File
@@ -0,0 +1,16 @@
let
# Read all files in the current directory
files = builtins.readDir ./.;
# Filter out default.nix and non-.nix files
nixFiles = builtins.filter
(name: name != "default.nix" && builtins.match ".*\\.nix" name != null)
(builtins.attrNames files);
# Create a list of import statements
imports = map (name: ./. + "/${name}") nixFiles;
in {
# Import all configuration modules automatically
imports = imports;
}
+10
View File
@@ -0,0 +1,10 @@
{
plugins = {
conform-nvim = {
enable = true;
settings = { formatters_by_ft.go = [ "golines" ]; };
};
lsp.servers.gopls.enable = true;
none-ls.sources.formatting.golines.enable = true;
};
}
+11
View File
@@ -42,6 +42,14 @@
}; };
extraSpecialArgs = { }; extraSpecialArgs = { };
}; };
goNixvimModule = {
inherit pkgs;
module = { pkgs, ... }: {
imports = [ ./config ./config/golang ];
extraPackages = with pkgs; [ sops ];
};
extraSpecialArgs = { };
};
pkgs = import inputs.nixpkgs { pkgs = import inputs.nixpkgs {
inherit system overlays; inherit system overlays;
config.allowUnfree = true; config.allowUnfree = true;
@@ -49,6 +57,7 @@
baseNvim = nixvim'.makeNixvimWithModule baseNixvimModule; baseNvim = nixvim'.makeNixvimWithModule baseNixvimModule;
rustNvim = nixvim'.makeNixvimWithModule rustNixvimModule; rustNvim = nixvim'.makeNixvimWithModule rustNixvimModule;
csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule; csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule;
goNvim = nixvim'.makeNixvimWithModule goNixvimModule;
in { in {
checks = { checks = {
# Run `nix flake check .` to verify that your config is not broken # Run `nix flake check .` to verify that your config is not broken
@@ -62,6 +71,8 @@
rust = rustNvim; rust = rustNvim;
# Lets you run `nix run .#csharp` to start nixvim with C# configuration # Lets you run `nix run .#csharp` to start nixvim with C# configuration
csharp = csharpNvim; csharp = csharpNvim;
# Lets you run `nix run .#golang` to start nixvim with Go configuration
golang = goNvim;
}; };
}; };
}; };