From 4972eb4147e73d1b1d6d1e3e50e7428d9b94bf34 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Tue, 1 Oct 2024 20:48:05 -0400 Subject: [PATCH] Initial CSharp support --- config/csharp/dap.nix | 9 +++++++++ config/csharp/default.nix | 16 ++++++++++++++++ config/csharp/lsp.nix | 11 +++++++++++ flake.nix | 11 +++++++++++ 4 files changed, 47 insertions(+) create mode 100644 config/csharp/dap.nix create mode 100644 config/csharp/default.nix create mode 100644 config/csharp/lsp.nix diff --git a/config/csharp/dap.nix b/config/csharp/dap.nix new file mode 100644 index 0000000..b486754 --- /dev/null +++ b/config/csharp/dap.nix @@ -0,0 +1,9 @@ +{ + plugins.dap = { + enable = true; + extensions = { + dap-ui.enable = true; + dap-virtual-text.enable = true; + }; + }; +} diff --git a/config/csharp/default.nix b/config/csharp/default.nix new file mode 100644 index 0000000..3d7eebc --- /dev/null +++ b/config/csharp/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/csharp/lsp.nix b/config/csharp/lsp.nix new file mode 100644 index 0000000..04bd723 --- /dev/null +++ b/config/csharp/lsp.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: { + plugins = { + conform-nvim = { + enable = true; + # settings = { formatters_by_ft.cs = [ "csharpier" ]; }; + }; + + lsp.servers.csharp-ls = { enable = true; }; + }; +} + diff --git a/flake.nix b/flake.nix index 09d1edd..b7f7ac6 100644 --- a/flake.nix +++ b/flake.nix @@ -34,12 +34,21 @@ }; extraSpecialArgs = { }; }; + csharpNixvimModule = { + inherit pkgs; + module = { pkgs, ... }: { + imports = [ ./config ./config/csharp ]; + extraPackages = with pkgs; [ sops dotnet-sdk_8 csharpier ]; + }; + extraSpecialArgs = { }; + }; pkgs = import inputs.nixpkgs { inherit system overlays; config.allowUnfree = true; }; baseNvim = nixvim'.makeNixvimWithModule baseNixvimModule; rustNvim = nixvim'.makeNixvimWithModule rustNixvimModule; + csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule; in { checks = { # Run `nix flake check .` to verify that your config is not broken @@ -51,6 +60,8 @@ default = baseNvim; # Lets you run `nix run .#rust` to start nixvim with Rust configuration rust = rustNvim; + # Lets you run `nix run .#csharp` to start nixvim with C# configuration + csharp = csharpNvim; }; }; };