File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 184184 '' ;
185185 default = [ ] ;
186186 } ;
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+
187206 } ;
188207
189208 config = {
190209 raw =
191210 {
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 ;
193212 id = config . name ;
194213 exclude = mergeExcludes config . excludes ;
195214 } ;
Original file line number Diff line number Diff line change 3030 enabledHooks = filterAttrs ( id : value : value . enable ) cfg . hooks ;
3131 enabledExtraPackages = builtins . concatLists ( mapAttrsToList ( _ : value : value . extraPackages ) enabledHooks ) ;
3232 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 ;
3448
3549 configFile =
3650 performAssertions (
You can’t perform that action at this time.
0 commit comments