From 617cc7d4827d39e9dc557111755d7e4bc59ea47c Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Thu, 26 Sep 2024 16:56:27 +0200 Subject: [PATCH] modules/languages/nix: change nixpkgs-fmt to nixfmt (rfc-style) --- docs/release-notes/rl-0.7.md | 4 ++++ modules/plugins/languages/nix.nix | 20 +++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 7fd4876..6da20aa 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -39,6 +39,10 @@ everyone. ## Changelog {#sec-release-0.7-changelog} +[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). + [ItsSorae](https://github.com/ItsSorae): - Add support for [typst](https://typst.app/) under `vim.languages.typst` This diff --git a/modules/plugins/languages/nix.nix b/modules/plugins/languages/nix.nix index 6cf1f90..69ab9c9 100644 --- a/modules/plugins/languages/nix.nix +++ b/modules/plugins/languages/nix.nix @@ -27,12 +27,12 @@ servers = { rnix = { package = pkgs.rnix-lsp; - internalFormatter = cfg.format.type == "nixpkgs-fmt"; + internalFormatter = cfg.format.type == "nixfmt"; lspConfig = '' lspconfig.rnix.setup{ capabilities = capabilities, ${ - if (cfg.format.enable && cfg.format.type == "nixpkgs-fmt") + if (cfg.format.enable && cfg.format.type == "nixfmt") then useFormat else noFormat }, @@ -62,10 +62,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 +90,9 @@ ''; }; - nixpkgs-fmt = { - package = pkgs.nixpkgs-fmt; - # Never need to use null-ls for nixpkgs-fmt + nixfmt = { + package = pkgs.nixfmt-rfc-style; + # Never need to use null-ls for nixfmt }; }; @@ -175,6 +175,12 @@ in { config = mkIf cfg.enable (mkMerge [ { + assertions = [ + { + assertion = cfg.format.type != "nixpkgs-fmt"; + message = "nixpkgs-fmt has been deprecated."; + } + ]; vim.pluginRC.nix = '' vim.api.nvim_create_autocmd("FileType", { pattern = "nix",