diff options
| author | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-24 04:11:00 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-24 04:14:31 +0530 |
| commit | 574b4e4651495ed3fb14ef53a00374782d45b378 (patch) | |
| tree | fcb1ea91f1462f20acabb4c027209d776d9136f9 | |
| parent | 5ea8c30b7b82d4c1e7164541892066b1f24f7d22 (diff) | |
| download | home-manager-config-574b4e4651495ed3fb14ef53a00374782d45b378.tar.gz home-manager-config-574b4e4651495ed3fb14ef53a00374782d45b378.zip | |
feat(flake): add lua and shell formatters to nix fmt
| -rw-r--r-- | flake.nix | 30 | ||||
| -rw-r--r-- | modules/file-management/yazi/file-chooser.sh | 4 |
2 files changed, 29 insertions, 5 deletions
@@ -15,6 +15,10 @@ url = "github:cachix/git-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; nixConfig = { @@ -35,6 +39,7 @@ home-manager, nixvim, git-hooks, + treefmt-nix, ... }: let @@ -44,10 +49,26 @@ inherit pkgs; lib = pkgs.lib; }; + + treefmtEval = treefmt-nix.lib.evalModule pkgs { + projectRootFile = "flake.nix"; + programs = { + nixfmt.enable = true; + stylua.enable = true; + shfmt = { + enable = true; + indent_size = 2; + }; + }; + }; + preCommitCheck = git-hooks.lib.${system}.run { src = ./.; hooks = { - nixfmt.enable = true; + treefmt = { + enable = true; + package = treefmtEval.config.build.wrapper; + }; forbid-private = { enable = true; name = "Forbid committing private files"; @@ -76,8 +97,11 @@ type = "app"; program = "${updates}/bin/updates"; }; - formatter.${system} = pkgs.nixfmt-tree; - checks.${system}.pre-commit-check = preCommitCheck; + formatter.${system} = treefmtEval.config.build.wrapper; + checks.${system} = { + pre-commit-check = preCommitCheck; + formatting = treefmtEval.config.build.check self; + }; devShells.${system}.default = pkgs.mkShell { inherit (preCommitCheck) shellHook; buildInputs = preCommitCheck.enabledPackages ++ [ diff --git a/modules/file-management/yazi/file-chooser.sh b/modules/file-management/yazi/file-chooser.sh index 788a5d9..bb5c7cc 100644 --- a/modules/file-management/yazi/file-chooser.sh +++ b/modules/file-management/yazi/file-chooser.sh @@ -18,6 +18,6 @@ if [ "$directory" = "1" ]; then # Outputs the final working directory path on exit exec yazi "$path" --cwd-file="$out" else - # Writes all selected file paths to the output file on exit - exec yazi "$path" --chooser-file="$out" + # Writes all selected file paths to the output file on exit + exec yazi "$path" --chooser-file="$out" fi |
