File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ stdenv.mkDerivation {
36
36
propagatedBuildInputs = [ lua5_3 gmp ] ;
37
37
38
38
buildPhase = ''
39
- ghc -o ${ main } app/${ main } -threaded -rtsopts -iapp -O2 -split-sections
39
+ ghc -o ${ main } app/${ main } -threaded -rtsopts -iapp -O2 -split-sections -DNODE_BIN_PATH="\" ${ nodeDependencies } /bin\""
40
40
'' ;
41
41
42
42
installPhase = ''
Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE CPP #-}
1
2
module Shake.Utils
2
3
( nodeCommand
3
4
, readJSONFile
@@ -7,10 +8,21 @@ import Data.Aeson
7
8
8
9
import Development.Shake
9
10
10
- -- | Invoke a command either from `PATH` or from `node_modules/.bin`
11
+ -- | Invoke a Node command. On Nix builds (more generally, if the
12
+ -- @NODE_BIN_PATH@ preprocessor macro is set while compiling), this will
13
+ -- look for the command in a statically-known path. Otherwise, it'll try
14
+ -- from @node_modules/.bin@ or your @PATH@.
11
15
nodeCommand :: CmdResult r => [CmdOption ] -> String -> [String ] -> Action r
16
+ #ifdef NODE_BIN_PATH
17
+
18
+ nodeCommand opts path = command opts ( NODE_BIN_PATH ++ " /" ++ path )
19
+
20
+ #else
21
+
12
22
nodeCommand opts = command (opts ++ [AddPath [] [" node_modules/.bin" ]])
13
23
24
+ #endif
25
+
14
26
-- | Read and decode JSON from a file, tracking it as a dependency.
15
27
readJSONFile :: FromJSON b => FilePath -> Action b
16
28
readJSONFile path = need [path] >> liftIO (eitherDecodeFileStrict' path) >>= either fail pure
You can’t perform that action at this time.
0 commit comments