File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 135
135
default = true ;
136
136
} ;
137
137
138
+ priority = mkOption {
139
+ type = types . number ;
140
+ description = ''
141
+ Defines the priority order in which hooks are executed.
142
+ Lower the number, the higher the precedence.
143
+ '' ;
144
+ default = 0 ;
145
+ } ;
146
+
138
147
fail_fast = mkOption {
139
148
type = types . bool ;
140
149
description = ''
189
198
config = {
190
199
raw =
191
200
{
192
- inherit ( config ) name entry language files types types_or exclude_types pass_filenames fail_fast require_serial stages verbose always_run args ;
201
+ inherit ( config ) name entry language files types types_or exclude_types pass_filenames priority fail_fast require_serial stages verbose always_run args ;
193
202
id = config . name ;
194
203
exclude = mergeExcludes config . excludes ;
195
204
} ;
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
+ # Sort the list of hooks by priority (lower number = higher priority)
35
+ sortedHooks = builtins . sort
36
+ ( a : b : a . priority < b . priority )
37
+ ( mapAttrsToList
38
+ ( id : value :
39
+ value . raw // {
40
+ inherit id ;
41
+ priority = value . raw . priority ;
42
+ }
43
+ )
44
+ enabledHooks
45
+ ) ;
46
+ in
47
+ sortedHooks ;
34
48
35
49
configFile =
36
50
performAssertions (
You can’t perform that action at this time.
0 commit comments