Switch nix formatter again to nixfmt-rfc-style

This commit is contained in:
2025-07-07 19:04:51 +02:00
parent bf7732761b
commit 80ed32f741
4 changed files with 54 additions and 6 deletions
-3
View File
@@ -36,9 +36,6 @@
# Your custom packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt'
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit inputs;};
@@ -2,6 +2,7 @@
imports = [
./cmp.nix
./lsp.nix
./fmt.nix
./treesitter.nix
./lualine.nix
./nvim-autopairs.nix
@@ -0,0 +1,53 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
stylua
nixfmt-rfc-style
];
programs.nixvim = {
opts.formatexpr = "v:lua.require'conform'.formatexpr()";
plugins.conform-nvim = {
enable = true;
lazyLoad.enable = true;
lazyLoad.settings = {
event = "BufWritePre";
cmd = "ConformInfo";
keys = [
{
__unkeyed-1 = "<leader>f";
__unkeyed-2.__raw = ''
function() require 'conform'.format { async = true } end
'';
desc = "Format Buffer";
}
];
};
settings = {
default_format_opts.lsp_format = "fallback";
format_on_save = ''
function(bufnr)
local disable_filetypes = { c = true, cpp = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
else
lsp_format_opt = 'fallback'
end
return {
timeout_ms = 500,
lsp_format = lsp_format_opt,
}
end
'';
formatters_by_ft = {
lua = [ "stylua" ];
python = [ "black" ];
nix = [ "nixfmt" ];
};
};
};
};
}
@@ -23,9 +23,6 @@
pyright.enable = true;
};
};
lsp-format = {
enable = true;
};
};
};
}