Skip to content

Commit

Permalink
feat: use alejandra instead of nixpkgs-fmt in shell
Browse files Browse the repository at this point in the history
  • Loading branch information
yusdacra committed Mar 5, 2022
1 parent bc5186a commit 9f3486e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
preCommitHooks = builtins.fetchGit {
url = "https://github.com/cachix/pre-commit-hooks.nix.git";
ref = "master";
rev = "0398f0649e0a741660ac5e8216760bae5cc78579";
rev = "b6bc0b21e1617e2b07d8205e7fae7224036dfa4b";
};

sources = {inherit rustOverlay devshell nixpkgs dream2nix preCommitHooks;};
Expand Down
2 changes: 1 addition & 1 deletion src/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
src = root;
hooks = {
rustfmt.enable = true;
nixpkgs-fmt.enable = true;
alejandra.enable = true;
};
};
};
Expand Down
11 changes: 5 additions & 6 deletions src/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ common: let
};
};
packages =
[pkgs.fd]
++ common.nativeBuildInputs
common.nativeBuildInputs
++ common.buildInputs
++ common.overrideNativeBuildInputs
++ common.overrideBuildInputs;
Expand All @@ -103,7 +102,7 @@ common: let
category = "vcs";
}
{
package = nixpkgs-fmt;
package = alejandra;
category = "tools";
}
{
Expand All @@ -127,13 +126,13 @@ common: let
{
name = "fmt";
category = "flake tools";
help = "Format all Rust and Nix files";
command = "rustfmt --edition 2018 $(fd --glob '*.rs') && nixpkgs-fmt $(fd --glob '*.nix')";
help = "Format all Nix files";
command = "alejandra $(pwd)";
}
{
name = "update-input";
category = "flake tools";
help = "Alias for `nix flake lock --update-input input`";
help = "Alias for `nix flake lock --update-input`";
command = "nix flake lock --update-input $@";
}
]
Expand Down

0 comments on commit 9f3486e

Please sign in to comment.