diff --git a/modules/hooks.nix b/modules/hooks.nix index db5aed76..6b8b5522 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -4,7 +4,7 @@ let cfg = config; hooks = config.hooks; settings = config.settings; - inherit (lib) mkDefault mkOption mkRenamedOptionModule types; + inherit (lib) mapAttrs mkDefault mkOption mkRenamedOptionModule types; hookModule = [ @@ -1241,31 +1241,31 @@ in type = types.submodule { imports = hookModule; options.settings = { - # package = mkOption { - # type = types.package; - # description = lib.mdDoc - # '' - # The `treefmt` package to use. - # - # Should include all the formatters configured by treefmt. - # - # For example: - # ```nix - # pkgs.writeShellApplication { - # name = "treefmt"; - # runtimeInputs = [ - # pkgs.treefmt - # pkgs.nixpkgs-fmt - # pkgs.black - # ]; - # text = - # ''' - # exec treefmt "$@" - # '''; - # } - # ``` - # ''; - # }; + package = mkOption { + type = types.package; + description = lib.mdDoc + '' + The `treefmt` package to use. + + Should include all the formatters configured by treefmt. + + For example: + ```nix + pkgs.writeShellApplication { + name = "treefmt"; + runtimeInputs = [ + pkgs.treefmt + pkgs.nixpkgs-fmt + pkgs.black + ]; + text = + ''' + exec treefmt "$@" + '''; + } + ``` + ''; + }; }; }; }; @@ -1406,7 +1406,7 @@ in }; # PLEASE keep this sorted alphabetically. - config.hooks = + config.hooks = mapAttrs (_: mapAttrs (_: mkDefault)) { actionlint = { @@ -2405,7 +2405,7 @@ in '' ${hooks.pre-commit-hook-ensure-sops.package}/bin/pre-commit-hook-ensure-sops ''; - files = lib.mkDefault "^secrets"; + files = "^secrets"; }; # See all CLI flags for prettier [here](https://prettier.io/docs/en/cli.html). # See all options for prettier [here](https://prettier.io/docs/en/options.html). @@ -2727,7 +2727,7 @@ in description = "One CLI to format the code tree."; types = [ "file" ]; pass_filenames = true; - package = mkDefault tools.treefmt; + package = tools.treefmt; entry = "${hooks.treefmt.package}/bin/treefmt --fail-on-change"; }; typos =