File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 18
18
, preCheck ? null , postCheck ? null
19
19
, preInstall ? null , postInstall ? null
20
20
, preHaddock ? null , postHaddock ? null
21
- , shellHook ? null
21
+ , shellHook ? ""
22
22
23
23
, doCheck ? component . doCheck || haskellLib . isTest componentId
24
24
, doCrossCheck ? component . doCrossCheck || false
187
187
inherit configFiles ;
188
188
} ;
189
189
190
+ # In order to let shell hooks make package-specific things like Hoogle databases
191
+ shellHookApplied = if builtins . isString shellHook then shellHook else
192
+ if builtins . isFunction shellHook then shellHook { inherit package shellWrappers ; }
193
+ else abort "shellHook should be a string or a function" ;
194
+
190
195
# the target dir for haddock documentation
191
196
docdir = docoutput : docoutput + "/share/doc/" + componentId . cname ;
192
197
@@ -332,7 +337,7 @@ stdenv.mkDerivation ({
332
337
333
338
shellHook = ''
334
339
export PATH="${ shellWrappers } /bin:$PATH"
335
- ${ toString shellHook }
340
+ ${ shellHookApplied }
336
341
'' ;
337
342
}
338
343
# patches can (if they like) depend on the version and revision of the package.
Original file line number Diff line number Diff line change 5
5
inherit haskellLib ;
6
6
ghc = config . ghc . package ;
7
7
buildGHC = buildModules . config . ghc . package ;
8
- inherit ( config ) nonReinstallablePkgs hsPkgs ;
8
+ inherit ( config ) nonReinstallablePkgs hsPkgs shellHook ;
9
9
inherit ghcForComponent ;
10
10
} ;
11
11
Original file line number Diff line number Diff line change 73
73
type = bool ;
74
74
default = ( def . doHaddock or true ) ;
75
75
} ;
76
+ shellHook = mkOption {
77
+ description = "Hook to run when entering a shell" ;
78
+ type = unspecified ; # Can be either a string or a function
79
+ default = ( def . shellHook or "" ) ;
80
+ } ;
76
81
} ;
77
82
packageOptions = def : componentOptions def // {
78
83
preUnpack = mkOption {
123
128
type = nullOr string ;
124
129
default = ( def . postHaddock or null ) ;
125
130
} ;
126
- shellHook = mkOption {
127
- type = nullOr string ;
128
- default = ( def . shellHook or null ) ;
129
- } ;
130
131
} ;
131
132
132
133
You can’t perform that action at this time.
0 commit comments