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
+2 -1
View File
@@ -31,7 +31,7 @@ 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 |
@@ -50,3 +50,4 @@ The default configuration performs editing without settings for any particular l
| 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"];
}; };
}; };
+35 -35
View File
@@ -6,41 +6,34 @@
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
overlays = [ (import rust-overlay) ];
nixvimLib = nixvim.lib.${system}; nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system}; nixvim' = nixvim.legacyPackages.${system};
baseNixvimModule = { baseNixvimModule = {
inherit pkgs; inherit pkgs;
module = module = {pkgs, ...}: {
{ pkgs, ... }: imports = [./config];
{ extraPackages = with pkgs; [sops];
imports = [ ./config ];
extraPackages = with pkgs; [ sops ];
}; };
extraSpecialArgs = { }; extraSpecialArgs = {};
}; };
rustNixvimModule = { rustNixvimModule = {
inherit pkgs; inherit pkgs;
module = module = {pkgs, ...}: {
{ pkgs, ... }:
{
imports = [ imports = [
./config ./config
./config/rust ./config/rust
@@ -50,46 +43,51 @@
rust-bin.stable.latest.default rust-bin.stable.latest.default
]; ];
}; };
extraSpecialArgs = { }; extraSpecialArgs = {};
}; };
csharpNixvimModule = { csharpNixvimModule = {
inherit pkgs; inherit pkgs;
module = module = {pkgs, ...}: {
{ pkgs, ... }:
{
imports = [ imports = [
./config ./config
./config/csharp ./config/csharp
]; ];
extraPackages = with pkgs; [ sops ]; extraPackages = with pkgs; [sops];
}; };
extraSpecialArgs = { }; extraSpecialArgs = {};
}; };
goNixvimModule = { goNixvimModule = {
inherit pkgs; inherit pkgs;
module = module = {pkgs, ...}: {
{ pkgs, ... }:
{
imports = [ imports = [
./config ./config
./config/golang ./config/golang
]; ];
extraPackages = with pkgs; [ sops ]; extraPackages = with pkgs; [sops];
}; };
extraSpecialArgs = { }; extraSpecialArgs = {};
}; };
pythonNixvimModule = { pythonNixvimModule = {
inherit pkgs; inherit pkgs;
module = module = {pkgs, ...}: {
{ pkgs, ... }:
{
imports = [ imports = [
./config ./config
./config/python ./config/python
]; ];
extraPackages = with pkgs; [ sops ]; extraPackages = with pkgs; [sops];
}; };
extraSpecialArgs = { }; extraSpecialArgs = {};
};
javascriptNixvimModule = {
inherit pkgs;
module = {pkgs, ...}: {
imports = [
./config
./config/javascript
];
extraPackages = with pkgs; [sops];
};
extraSpecialArgs = {};
}; };
pkgs = import inputs.nixpkgs { pkgs = import inputs.nixpkgs {
inherit system overlays; inherit system overlays;
@@ -100,8 +98,8 @@
csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule; csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule;
goNvim = nixvim'.makeNixvimWithModule goNixvimModule; goNvim = nixvim'.makeNixvimWithModule goNixvimModule;
pythonNvim = nixvim'.makeNixvimWithModule pythonNixvimModule; pythonNvim = nixvim'.makeNixvimWithModule pythonNixvimModule;
in javascriptNvim = nixvim'.makeNixvimWithModule javascriptNixvimModule;
{ 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
default = nixvimLib.check.mkTestDerivationFromNixvimModule baseNixvimModule; default = nixvimLib.check.mkTestDerivationFromNixvimModule baseNixvimModule;
@@ -117,6 +115,8 @@
golang = goNvim; golang = goNvim;
# Lets you run `nix run .#python` to start nixvim with Python configuration # Lets you run `nix run .#python` to start nixvim with Python configuration
python = pythonNvim; python = pythonNvim;
# Lets you run `nix run .#javascript` to start nixvim with JS/TS configuration
javascript = javascriptNvim;
}; };
}; };
}; };