Skip to content

Commit

Permalink
Replace nixpkgs-fmt with nixfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Mar 23, 2024
1 parent a6c9ac9 commit 66b8c14
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"nix.serverSettings": {
"nil": {
"formatting": {
"command": ["nixpkgs-fmt"]
"command": ["nixfmt"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 10 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,27 @@

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 = [
# https://github.com/NixOS/nix/issues/730#issuecomment-162323824
# https://github.com/kachick/dotfiles/pull/228
bashInteractive

nixfmt
nil
nixpkgs-fmt
dprint
typos
go-task
];
};
}
);
});
}

0 comments on commit 66b8c14

Please sign in to comment.