Skip to content

Commit

Permalink
feat: add treefmt-nix
Browse files Browse the repository at this point in the history
  • Loading branch information
amadalusia committed Oct 4, 2024
1 parent 1ed925b commit d53a45f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
21 changes: 21 additions & 0 deletions flake.lock

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

8 changes: 7 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
inputs.hyprutils.follows = "hyprutils";
inputs.hyprwayland-scanner.follows = "hyprwayland-scanner";
};

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

outputs = inputs @ {
Expand Down Expand Up @@ -82,6 +87,7 @@
hyprland-extras
];
});
treefmtEval = eachSystem (system: inputs.treefmt-nix.lib.evalModule pkgsFor.${system} ./nix/treefmt.nix);
in {
overlays = import ./nix/overlays.nix {inherit self lib inputs;};

Expand Down Expand Up @@ -122,7 +128,7 @@
};
});

formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.alejandra);
formatter = eachSystem (system: treefmtEval.${system}.config.build.wrapper);

nixosModules.default = import ./nix/module.nix inputs;
homeManagerModules.default = import ./nix/hm-module.nix self;
Expand Down
8 changes: 8 additions & 0 deletions nix/treefmt.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_: {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
clang-format.enable = true;
};
settings.global.excludes = ["!*.cpp" "!*.nix"];
}

0 comments on commit d53a45f

Please sign in to comment.