From 9125bfeaffbc6417501b9489db647669fc8c89fb Mon Sep 17 00:00:00 2001 From: oxalica Date: Wed, 18 Sep 2024 23:06:38 -0400 Subject: [PATCH] Update docs examples to use nixfmt-rfc-style This is now the chosen formatter for nixpkgs. --- README.md | 6 +++--- dev/nvim-lsp.nix | 2 +- dev/vim-coc.nix | 2 +- docs/configuration.md | 2 +- flake.nix | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b842875..141b342 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Merge this setting into your `coc-settings.json` (open with `:CocConfig`). // Uncomment these to tweak settings. // "settings": { // "nil": { - // "formatting": { "command": ["nixpkgs-fmt"] } + // "formatting": { "command": ["nixfmt"] } // } // } } @@ -108,7 +108,7 @@ Add the following elisp code to your configuration. (using `use-package`) :after (lsp-mode) :demand t :custom - (lsp-nix-nil-formatter ["nixpkgs-fmt"])) + (lsp-nix-nil-formatter ["nixfmt"])) (use-package nix-mode :hook (nix-mode . lsp-deferred) @@ -144,7 +144,7 @@ Modify the extension's settings in your `settings.json`. // Uncomment these to tweak settings. // "nix.serverSettings": { // "nil": { - // "formatting": { "command": ["nixpkgs-fmt"] } + // "formatting": { "command": ["nixfmt"] } // } // } } diff --git a/dev/nvim-lsp.nix b/dev/nvim-lsp.nix index 444e83b..43a0705 100644 --- a/dev/nvim-lsp.nix +++ b/dev/nvim-lsp.nix @@ -88,7 +88,7 @@ let ['nil'] = { testSetting = 42, formatting = { - command = { "nixpkgs-fmt" }, + command = { "nixfmt" }, }, }, }, diff --git a/dev/vim-coc.nix b/dev/vim-coc.nix index 0da2c18..9b0a505 100644 --- a/dev/vim-coc.nix +++ b/dev/vim-coc.nix @@ -97,7 +97,7 @@ let nil.server.path = pkgs.writeShellScript "nil" '' exec "$NIL_PATH" "$@" ''; - nil.formatting.command = [ "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt" ]; + nil.formatting.command = [ (pkgs.lib.getExe pkgs.nixfmt-rfc-style) ]; nil.diagnostics.excludedFiles = [ "generated.nix" ]; nil.nix.flake.autoEvalInputs = true; nil.nix.maxMemoryMB = 2048; diff --git a/docs/configuration.md b/docs/configuration.md index 0e17212..db40dfc 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -23,7 +23,7 @@ Default configuration: // External formatter command (with arguments). // It should accepts file content in stdin and print the formatted code into stdout. // Type: [string] | null - // Example: ["nixpkgs-fmt"] + // Example: ["nixfmt"] "command": null, }, "diagnostics": { diff --git a/flake.nix b/flake.nix index f9e4603..6dcb874 100644 --- a/flake.nix +++ b/flake.nix @@ -116,7 +116,7 @@ rec { jq pre-commit - nixpkgs-fmt + nixfmt-rfc-style (import ./dev/nvim-lsp.nix { inherit pkgs; }) (import ./dev/vim-coc.nix { inherit pkgs; }) (import ./dev/vim-lsp.nix { inherit pkgs; })