File tree 2 files changed +35
-2
lines changed 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 184
184
'' ;
185
185
default = [ ] ;
186
186
} ;
187
+
188
+ before = mkOption {
189
+ type = types . listOf types . str ;
190
+ description =
191
+ ''
192
+ List of hooks that should run after this hook.
193
+ '' ;
194
+ default = [ ] ;
195
+ } ;
196
+
197
+ after = mkOption {
198
+ type = types . listOf types . str ;
199
+ description =
200
+ ''
201
+ List of hooks that should run before this hook.
202
+ '' ;
203
+ default = [ ] ;
204
+ } ;
205
+
187
206
} ;
188
207
189
208
config = {
190
209
raw =
191
210
{
192
- inherit ( config ) name entry language files types types_or exclude_types pass_filenames fail_fast require_serial stages verbose always_run args ;
211
+ inherit ( config ) name entry language files types types_or exclude_types pass_filenames fail_fast require_serial stages verbose always_run args before after ;
193
212
id = config . name ;
194
213
exclude = mergeExcludes config . excludes ;
195
214
} ;
Original file line number Diff line number Diff line change 30
30
enabledHooks = filterAttrs ( id : value : value . enable ) cfg . hooks ;
31
31
enabledExtraPackages = builtins . concatLists ( mapAttrsToList ( _ : value : value . extraPackages ) enabledHooks ) ;
32
32
processedHooks =
33
- mapAttrsToList ( id : value : value . raw // { inherit id ; } ) enabledHooks ;
33
+ let
34
+ sortedHooks = lib . toposort
35
+ ( a : b : builtins . elem b . id a . before || builtins . elem a . id b . after )
36
+ ( mapAttrsToList
37
+ ( id : value :
38
+ value . raw // {
39
+ inherit id ;
40
+ before = value . raw . before ;
41
+ after = value . raw . after ;
42
+ }
43
+ )
44
+ enabledHooks
45
+ ) ;
46
+ in
47
+ sortedHooks . result ;
34
48
35
49
configFile =
36
50
performAssertions (
You can’t perform that action at this time.
0 commit comments