feat: move neovim fmt to nixfmt

This commit is contained in:
Julien Malka 2024-05-01 19:07:09 +02:00
parent 65bf3fc0a8
commit 32b92ec71d
Signed by: Luj
GPG key ID: 6FC74C847011FD83

View file

@ -1,7 +1,12 @@
{ pkgs, home, lib, config, ... }: {
pkgs,
home,
lib,
config,
...
}:
let let
cfg = config.luj.programs.neovim; cfg = config.luj.programs.neovim;
in in
with lib; with lib;
{ {
@ -11,7 +16,12 @@ with lib;
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ nixfmt git nodejs ripgrep gcc ]; home.packages = with pkgs; [
git
nodejs
ripgrep
gcc
];
programs.neovim = { programs.neovim = {
enable = true; enable = true;
@ -23,15 +33,23 @@ with lib;
coc = { coc = {
enable = true; enable = true;
settings = { settings = {
coc.preferences.formatOnSaveFiletypes = [ "nix" "rust" "sql" "python" "haskell" ]; coc.preferences.formatOnSaveFiletypes = [
"nix"
"rust"
"sql"
"python"
"haskell"
];
rust-analyzer.enable = true; rust-analyzer.enable = true;
rust-analyzer.cargo.allFeatures = true; rust-analyzer.cargo.allFeatures = true;
rust-analyzer.checkOnSave.allTargets = true; rust-analyzer.checkOnSave.allTargets = true;
languageserver = languageserver = {
{
python = { python = {
command = "pyright"; command = "pyright";
filetypes = [ "py" "python" ]; filetypes = [
"py"
"python"
];
}; };
haskell = { haskell = {
@ -43,7 +61,12 @@ with lib;
"hie.yaml" "hie.yaml"
".stack.yaml" ".stack.yaml"
]; ];
filetypes = [ "haskell" "lhaskell" "hs" "lhs" ]; filetypes = [
"haskell"
"lhaskell"
"hs"
"lhs"
];
settings = { settings = {
haskell = { haskell = {
checkParents = "CheckOnSave"; checkParents = "CheckOnSave";
@ -56,7 +79,13 @@ with lib;
go = { go = {
command = "gopls"; command = "gopls";
rootPatterns = [ "go.work" "go.mod" ".vim/" ".git/" ".hg/" ]; rootPatterns = [
"go.work"
"go.mod"
".vim/"
".git/"
".hg/"
];
filetypes = [ "go" ]; filetypes = [ "go" ];
initializationOptions = { initializationOptions = {
usePlaceholders = true; usePlaceholders = true;
@ -66,12 +95,24 @@ with lib;
nix = { nix = {
command = "nixd"; command = "nixd";
filetypes = [ "nix" ]; filetypes = [ "nix" ];
settings.nixd.formatting.command = [ "nixfmt" ];
}; };
ccls = { ccls = {
command = "ccls"; command = "ccls";
filetypes = [ "c" "cpp" "objc" "objcpp" ]; filetypes = [
rootPatterns = [ ".ccls" "compile_commands.json" ".vim/" ".git/" ".hg/" ]; "c"
"cpp"
"objc"
"objcpp"
];
rootPatterns = [
".ccls"
"compile_commands.json"
".vim/"
".git/"
".hg/"
];
initializationOptions = { initializationOptions = {
cache = { cache = {
directory = "/tmp/ccls"; directory = "/tmp/ccls";
@ -98,11 +139,12 @@ with lib;
pears-nvim pears-nvim
nvim-tree-lua nvim-tree-lua
(nvim-treesitter.withPlugins (ps: with ps; [ (nvim-treesitter.withPlugins (
ps: with ps; [
tree-sitter-nix tree-sitter-nix
tree-sitter-python tree-sitter-python
])) ]
))
vim-lastplace vim-lastplace
vim-nix vim-nix
@ -120,7 +162,15 @@ with lib;
rust-vim rust-vim
]; ];
extraPackages = with pkgs; [ rust-analyzer pkgs.nixd pyright nixpkgs-fmt ormolu ccls gopls ]; extraPackages = with pkgs; [
rust-analyzer
pkgs.nixd
pyright
ormolu
ccls
gopls
unstable.nixfmt-rfc-style
];
extraConfig = '' extraConfig = ''
luafile ${./settings.lua} luafile ${./settings.lua}
@ -128,4 +178,3 @@ with lib;
}; };
}; };
} }