From 66b8c14f866fcc8adbdf3df9d8400dbbcfcb9ea5 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 23 Mar 2024 23:35:51 +0900 Subject: [PATCH] Replace nixpkgs-fmt with nixfmt --- .vscode/settings.json | 2 +- Taskfile.yml | 2 +- flake.nix | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 8dbba70..e5a6ac6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,7 @@ "nix.serverSettings": { "nil": { "formatting": { - "command": ["nixpkgs-fmt"] + "command": ["nixfmt"] } } } diff --git a/Taskfile.yml b/Taskfile.yml index f260105..8184e12 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -24,7 +24,7 @@ tasks: - dprint check - typos . .github .vscode # nix fmt doesn't have check: https://github.com/NixOS/nix/issues/6918 - - nixpkgs-fmt --check ./*.nix + - nixfmt --check ./*.nix deps: cmds: - nix --version diff --git a/flake.nix b/flake.nix index 8b41f11..d6b439f 100644 --- a/flake.nix +++ b/flake.nix @@ -11,11 +11,14 @@ outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - { - formatter = pkgs.nixpkgs-fmt; + let pkgs = nixpkgs.legacyPackages.${system}; + in { + # Q. Why nixfmt? Not nixpkgs-fmt and alejandra? + # A. nixfmt will be official + # - https://github.com/NixOS/nixfmt/issues/153 + # - https://github.com/NixOS/nixfmt/issues/129 + # - https://github.com/NixOS/rfcs/pull/166 + formatter = pkgs.nixfmt; devShells.default = with pkgs; mkShell { buildInputs = [ @@ -23,13 +26,12 @@ # https://github.com/kachick/dotfiles/pull/228 bashInteractive + nixfmt nil - nixpkgs-fmt dprint typos go-task ]; }; - } - ); + }); }