Skip to content

Commit

Permalink
Add alias option to hooks
Browse files Browse the repository at this point in the history
Allows referring to a hook using an optional alias, in addition to the
hook id.
  • Loading branch information
sandydoo committed Dec 15, 2024
1 parent 96209c1 commit ebbaef9
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions modules/hook.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ in
'';
};

alias = mkOption {
type = types.nullOr types.str;
description =
''
An optional alias for the hook.
Allows the hook to referenced using an additional id.
```
'';
default = null;
};

name = mkOption {
type = types.str;
default = name;
Expand Down Expand Up @@ -236,8 +248,23 @@ in
config = {
raw =
{
inherit (config) id name entry language files types types_or exclude_types pass_filenames fail_fast require_serial stages verbose always_run args;
inherit (config)
always_run
args
entry
exclude_types
fail_fast
files
id
language
name
pass_filenames
require_serial
stages
types
types_or
verbose;
exclude = mergeExcludes config.excludes;
};
} // lib.optionalAttrs (config.alias != null) { alias = config.alias; };
};
}

0 comments on commit ebbaef9

Please sign in to comment.