Skip to content

Commit

Permalink
chore(formatting): replace treefmt-nix with treefmt for formatting
Browse files Browse the repository at this point in the history
- Removed treefmt-nix dependency and all related configurations.
- Added a new treefmt.toml file for formatting with nixfmt and ruff.
- Updated .gitignore to ignore result files and .direnv.
- Removed treefmt.nix and adjusted flake.nix accordingly.
- Updated development shell to include nixfmt-rfc-style.
  • Loading branch information
HeitorAugustoLN committed Sep 24, 2024
1 parent bbf5f85 commit eaede2f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 42 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
result*
.direnv
23 changes: 1 addition & 22 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 2 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs =
Expand All @@ -25,17 +21,12 @@
inputs.nixpkgs.lib.genAttrs supportedSystems (
system: function inputs.nixpkgs.legacyPackages.${system}
);

treefmtEval = forAllSystems (pkgs: inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in
{
checks = forAllSystems (pkgs: {
formatting = treefmtEval.${pkgs.system}.config.build.check inputs.self;
});

devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nixfmt-rfc-style
ruff
(python3.withPackages (
pyPkgs: with pyPkgs; [
Expand All @@ -48,7 +39,7 @@
};
});

formatter = forAllSystems (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
formatter = forAllSystems (pkgs: pkgs.treefmt);

homeManagerModules.betterfox = import ./modules;

Expand Down
9 changes: 0 additions & 9 deletions treefmt.nix

This file was deleted.

21 changes: 21 additions & 0 deletions treefmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[global]
excludes = ["autogen"]

[formatter.nixfmt]
command = "nixfmt"
includes = ["*.nix"]

[formatter.ruff-check]
command = "ruff"
options = ["check", "--fix"]
includes = ["*.py", "*.pyi"]

[formatter.ruff-format]
command = "ruff"
options = ["format"]
includes = ["*.py", "*.pyi"]

[formatter.ruff-organize-imports]
command = "ruff"
options = ["check", "--select", "I", "--fix"]
includes = ["*.py", "*.pyi"]

0 comments on commit eaede2f

Please sign in to comment.