diff --git a/README.md b/README.md index 3d0f4b9..39ba289 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,8 @@ The default configuration performs editing without settings for any particular l - Rust `nix run github:fred-drake/neovim#rust` - C# `nix run github:fred-drake/neovim#csharp` +- Go `nix run github:fred-drake/neovim#golang` ## Things To Do -- TODO: Implement DAP for debugging - 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. diff --git a/config/golang/debugging.nix b/config/golang/debugging.nix new file mode 100644 index 0000000..4008adb --- /dev/null +++ b/config/golang/debugging.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: { + plugins.dap.extensions.dap-go = { + enable = true; + delve.path = "${pkgs.delve}/bin/dlv"; + }; +} diff --git a/config/golang/default.nix b/config/golang/default.nix new file mode 100644 index 0000000..3d7eebc --- /dev/null +++ b/config/golang/default.nix @@ -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; +} + diff --git a/config/golang/language.nix b/config/golang/language.nix new file mode 100644 index 0000000..4f91bbe --- /dev/null +++ b/config/golang/language.nix @@ -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; + }; +} diff --git a/flake.nix b/flake.nix index 888e40f..f09b6b0 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,14 @@ }; extraSpecialArgs = { }; }; + goNixvimModule = { + inherit pkgs; + module = { pkgs, ... }: { + imports = [ ./config ./config/golang ]; + extraPackages = with pkgs; [ sops ]; + }; + extraSpecialArgs = { }; + }; pkgs = import inputs.nixpkgs { inherit system overlays; config.allowUnfree = true; @@ -49,6 +57,7 @@ baseNvim = nixvim'.makeNixvimWithModule baseNixvimModule; rustNvim = nixvim'.makeNixvimWithModule rustNixvimModule; csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule; + goNvim = nixvim'.makeNixvimWithModule goNixvimModule; in { checks = { # Run `nix flake check .` to verify that your config is not broken @@ -62,6 +71,8 @@ rust = rustNvim; # Lets you run `nix run .#csharp` to start nixvim with C# configuration csharp = csharpNvim; + # Lets you run `nix run .#golang` to start nixvim with Go configuration + golang = goNvim; }; }; };