Skip to content

Commit

Permalink
Apply mkDefault to built-in hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
sandydoo committed Feb 11, 2024
1 parent 6d04714 commit 9ad3507
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
[
Expand Down Expand Up @@ -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 "$@"
''';
}
```
'';
};
};
};
};
Expand Down Expand Up @@ -1406,7 +1406,7 @@ in
};

# PLEASE keep this sorted alphabetically.
config.hooks =
config.hooks = mapAttrs (_: mapAttrs (_: mkDefault))
{
actionlint =
{
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 9ad3507

Please sign in to comment.