mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 11:01:15 +00:00
Compare commits
1 commit
68377e8db1
...
235a130cd9
Author | SHA1 | Date | |
---|---|---|---|
|
235a130cd9 |
2 changed files with 24 additions and 6 deletions
|
@ -196,3 +196,7 @@ everyone.
|
|||
[Soliprem](https://github.com/Soliprem)
|
||||
|
||||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||
|
||||
[nezia1](https://github.com/nezia1):
|
||||
|
||||
- Replace [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) with [nixfmt](https://github.com/NixOS/nixfmt) (nixfmt-rfc-style).
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) concatStringsSep;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
|
@ -62,10 +63,10 @@
|
|||
command = {"${cfg.format.package}/bin/alejandra", "--quiet"},
|
||||
},
|
||||
''}
|
||||
${optionalString (cfg.format.type == "nixpkgs-fmt")
|
||||
${optionalString (cfg.format.type == "nixfmt")
|
||||
''
|
||||
formatting = {
|
||||
command = {"${cfg.format.package}/bin/nixpkgs-fmt"},
|
||||
command = {"${cfg.format.package}/bin/nixfmt"},
|
||||
},
|
||||
''}
|
||||
},
|
||||
|
@ -90,9 +91,16 @@
|
|||
'';
|
||||
};
|
||||
|
||||
nixpkgs-fmt = {
|
||||
package = pkgs.nixpkgs-fmt;
|
||||
# Never need to use null-ls for nixpkgs-fmt
|
||||
nixfmt = {
|
||||
package = pkgs.nixfmt-rfc-style;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.nixfmt.with({
|
||||
command = "${cfg.format.package}/bin/nixfmt"
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -152,7 +160,7 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Nix formatter to use";
|
||||
type = enum (attrNames formats);
|
||||
type = enum (attrNames formats ++ ["nixpkgs-fmt"]); # temporary, so it can be asserted against
|
||||
default = defaultFormat;
|
||||
};
|
||||
package = mkOption {
|
||||
|
@ -175,6 +183,12 @@ in {
|
|||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.format.type != "nixpkgs-fmt";
|
||||
message = "nixpkgs-fmt has been archived and replaced with nixfmt. Please use one of the following instead: ${concatStringsSep ", " (attrNames formats)}";
|
||||
}
|
||||
];
|
||||
vim.pluginRC.nix = ''
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "nix",
|
||||
|
|
Loading…
Reference in a new issue