Added node support

This commit is contained in:
Fred Drake
2024-10-05 21:45:06 -04:00
parent ee5b6054c1
commit 3034aa64aa
6 changed files with 222 additions and 129 deletions
+21 -20
View File
@@ -30,23 +30,24 @@ The default configuration performs editing without settings for any particular l
## Technology Support ## Technology Support
| Technology | Formatter | Language Server | Debugger | Nix Configuration | | Technology | Formatter | Language Server | Debugger | Nix Configuration |
| ---------- | ------------ | ---------------------------------- | ---------- | ----------------- | | ---------- | ------------ | ---------------------------------- | --------------- | ----------------- |
| Nix | alejandra | nil-ls, nixd | | default | | Nix | alejandra | nil-ls, nixd | | default |
| Just | just | | | default | | Just | just | | | default |
| SQL | sqlformat | | | default | | SQL | sqlformat | | | default |
| Lua | stylua | | | default | | Lua | stylua | | | default |
| YAML | yamlfmt | yamllint, yamlls | | default | | YAML | yamlfmt | yamllint, yamlls | | default |
| CSS | prettier | | | default | | CSS | prettier | | | default |
| HTML | prettier | | | default | | HTML | prettier | | | default |
| Javascript | prettier | | | default | | Javascript | prettier | | | default |
| Typescript | prettier | | | default | | Typescript | prettier | | | default |
| JSON | prettier | jsonls | | default | | JSON | prettier | jsonls | | default |
| Markdown | prettier | marksman | | default | | Markdown | prettier | marksman | | default |
| Ruby | rubyfmt | | | default | | Ruby | rubyfmt | | | default |
| Terraform | tofu_fmt | | | default | | Terraform | tofu_fmt | | | default |
| TOML | taplo | taplo | | default | | TOML | taplo | taplo | | default |
| C# | csharpier | csharp-ls | netcoredbg | csharp | | C# | csharpier | csharp-ls | netcoredbg | csharp |
| Go | golines | gopls | delve | golang | | Go | golines | gopls | delve | golang |
| Python | black, isort | flake8, jedi, pylint, rope, mccabe | dap-python | python | | Python | black, isort | flake8, jedi, pylint, rope, mccabe | dap-python | python |
| Rust | rustfmt | clippy | lldb | rust | | Rust | rustfmt | clippy | lldb | rust |
| Node | prettier | tsserver | vscode-js-debug | javascript |
+28
View File
@@ -0,0 +1,28 @@
{pkgs, ...}: {
plugins = {
dap = {
enable = true;
adapters.servers = {
"pwa-node" = {
host = "localhost";
port = 8123;
executable = {
command = "${pkgs.vscode-js-debug}/bin/js-debug";
};
};
};
};
};
extraConfigLua = ''
require("dap").configurations.javascript = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "''${file}",
cwd = "''${workspaceFolder}",
},
}
'';
}
+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;
}
+52
View File
@@ -0,0 +1,52 @@
{
plugins = {
conform-nvim = {
settings = {
formatters_by_ft.javascript = ["prettier"];
formatters_by_ft.typescript = ["prettier"];
formatters_by_ft.javascriptreact = ["prettier"];
formatters_by_ft.typescriptreact = ["prettier"];
};
};
lsp.servers.ts-ls = {
enable = true;
filetypes = [
"javascript"
"javascriptreact"
"typescript"
"typescriptreact"
];
extraOptions = {
settings = {
javascript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
typescript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
};
};
};
lsp.servers.eslint.enable = true;
none-ls.sources.formatting.prettier = {
enable = true;
disableTsServerFormatter = false;
};
};
}
-4
View File
@@ -175,8 +175,6 @@ in
formatters_by_ft = { formatters_by_ft = {
css = ["prettier"]; css = ["prettier"];
html = ["prettier"]; html = ["prettier"];
javascript = ["prettier"];
javascriptreact = ["prettier"];
json = ["prettier"]; json = ["prettier"];
just = ["just"]; just = ["just"];
lua = ["stylua"]; lua = ["stylua"];
@@ -185,8 +183,6 @@ in
ruby = ["rubyfmt"]; ruby = ["rubyfmt"];
terraform = ["tofu_fmt"]; terraform = ["tofu_fmt"];
tf = ["tofu_fmt"]; tf = ["tofu_fmt"];
typescript = ["prettier"];
typescriptreact = ["prettier"];
yaml = ["yamlfmt"]; yaml = ["yamlfmt"];
}; };
}; };
+105 -105
View File
@@ -6,118 +6,118 @@
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
rust-overlay.url = "github:oxalica/rust-overlay"; rust-overlay.url = "github:oxalica/rust-overlay";
}; };
outputs = outputs = {
{ nixvim,
nixvim, flake-parts,
flake-parts, rust-overlay,
rust-overlay, ...
... } @ inputs:
}@inputs: flake-parts.lib.mkFlake {inherit inputs;} {
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
"x86_64-darwin" "x86_64-darwin"
"aarch64-darwin" "aarch64-darwin"
]; ];
perSystem = perSystem = {system, ...}: let
{ system, ... }: overlays = [(import rust-overlay)];
let nixvimLib = nixvim.lib.${system};
overlays = [ (import rust-overlay) ]; nixvim' = nixvim.legacyPackages.${system};
nixvimLib = nixvim.lib.${system}; baseNixvimModule = {
nixvim' = nixvim.legacyPackages.${system}; inherit pkgs;
baseNixvimModule = { module = {pkgs, ...}: {
inherit pkgs; imports = [./config];
module = extraPackages = with pkgs; [sops];
{ pkgs, ... }:
{
imports = [ ./config ];
extraPackages = with pkgs; [ sops ];
};
extraSpecialArgs = { };
};
rustNixvimModule = {
inherit pkgs;
module =
{ pkgs, ... }:
{
imports = [
./config
./config/rust
];
extraPackages = with pkgs; [
sops
rust-bin.stable.latest.default
];
};
extraSpecialArgs = { };
};
csharpNixvimModule = {
inherit pkgs;
module =
{ pkgs, ... }:
{
imports = [
./config
./config/csharp
];
extraPackages = with pkgs; [ sops ];
};
extraSpecialArgs = { };
};
goNixvimModule = {
inherit pkgs;
module =
{ pkgs, ... }:
{
imports = [
./config
./config/golang
];
extraPackages = with pkgs; [ sops ];
};
extraSpecialArgs = { };
};
pythonNixvimModule = {
inherit pkgs;
module =
{ pkgs, ... }:
{
imports = [
./config
./config/python
];
extraPackages = with pkgs; [ sops ];
};
extraSpecialArgs = { };
};
pkgs = import inputs.nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
baseNvim = nixvim'.makeNixvimWithModule baseNixvimModule;
rustNvim = nixvim'.makeNixvimWithModule rustNixvimModule;
csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule;
goNvim = nixvim'.makeNixvimWithModule goNixvimModule;
pythonNvim = nixvim'.makeNixvimWithModule pythonNixvimModule;
in
{
checks = {
# Run `nix flake check .` to verify that your config is not broken
default = nixvimLib.check.mkTestDerivationFromNixvimModule baseNixvimModule;
};
packages = {
# Lets you run `nix run .` to start nixvim
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;
# Lets you run `nix run .#golang` to start nixvim with Go configuration
golang = goNvim;
# Lets you run `nix run .#python` to start nixvim with Python configuration
python = pythonNvim;
}; };
extraSpecialArgs = {};
}; };
rustNixvimModule = {
inherit pkgs;
module = {pkgs, ...}: {
imports = [
./config
./config/rust
];
extraPackages = with pkgs; [
sops
rust-bin.stable.latest.default
];
};
extraSpecialArgs = {};
};
csharpNixvimModule = {
inherit pkgs;
module = {pkgs, ...}: {
imports = [
./config
./config/csharp
];
extraPackages = with pkgs; [sops];
};
extraSpecialArgs = {};
};
goNixvimModule = {
inherit pkgs;
module = {pkgs, ...}: {
imports = [
./config
./config/golang
];
extraPackages = with pkgs; [sops];
};
extraSpecialArgs = {};
};
pythonNixvimModule = {
inherit pkgs;
module = {pkgs, ...}: {
imports = [
./config
./config/python
];
extraPackages = with pkgs; [sops];
};
extraSpecialArgs = {};
};
javascriptNixvimModule = {
inherit pkgs;
module = {pkgs, ...}: {
imports = [
./config
./config/javascript
];
extraPackages = with pkgs; [sops];
};
extraSpecialArgs = {};
};
pkgs = import inputs.nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
baseNvim = nixvim'.makeNixvimWithModule baseNixvimModule;
rustNvim = nixvim'.makeNixvimWithModule rustNixvimModule;
csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule;
goNvim = nixvim'.makeNixvimWithModule goNixvimModule;
pythonNvim = nixvim'.makeNixvimWithModule pythonNixvimModule;
javascriptNvim = nixvim'.makeNixvimWithModule javascriptNixvimModule;
in {
checks = {
# Run `nix flake check .` to verify that your config is not broken
default = nixvimLib.check.mkTestDerivationFromNixvimModule baseNixvimModule;
};
packages = {
# Lets you run `nix run .` to start nixvim
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;
# Lets you run `nix run .#golang` to start nixvim with Go configuration
golang = goNvim;
# Lets you run `nix run .#python` to start nixvim with Python configuration
python = pythonNvim;
# Lets you run `nix run .#javascript` to start nixvim with JS/TS configuration
javascript = javascriptNvim;
};
};
}; };
} }