@@ -26,16 +26,19 @@ import Hpack.Config
26import Hpack.Render
26import Hpack.Render
27import Hpack.Yaml
27import Hpack.Yaml
28import Language.Haskell.Extension
28import Language.Haskell.Extension
29−import Network.Socket
29+import Network.Socket hiding (Debug)
30import System.Directory
30import System.Directory
31import System.FilePath
31import System.FilePath
32+import System.Process (proc)
32import System.IO.Temp (withSystemTempDirectory)
33import System.IO.Temp (withSystemTempDirectory)
33import Data.ByteString (ByteString)
34import Data.ByteString (ByteString)
35import Obelisk.App (MonadObelisk, ObeliskT)
36import Obelisk.App (MonadObelisk, ObeliskT)
38+ ( CliT (..), HasCliConfig, Severity (..)
36−import Obelisk.CliApp (CliT (..), HasCliConfig, Severity (..), callCommand, failWith, getCliConfig, putLog,
39+ , callCommand, failWith, getCliConfig, putLog
37− runCli)
40+ , readProcessAndLogStderr, runCli)
38−import Obelisk.Command.Project (inProjectShell)
41+import Obelisk.Command.Project (inProjectShell, withProjectRoot)
40data CabalPackageInfo = CabalPackageInfo
43data CabalPackageInfo = CabalPackageInfo
41 { _cabalPackageInfo_packageRoot :: FilePath
44 { _cabalPackageInfo_packageRoot :: FilePath
@@ -51,7 +54,19 @@ run = do
51 pkgs <- getLocalPkgs
54 pkgs <- getLocalPkgs
52 withGhciScript pkgs $ \dotGhciPath -> do
55 withGhciScript pkgs $ \dotGhciPath -> do
53 freePort <- getFreePort
56 freePort <- getFreePort
54− runGhcid dotGhciPath $ Just $ unwords ["run", show freePort, "(runServeAsset Obelisk.Generated.Static.staticRootPath)", "Backend.backend", "Frontend.frontend"]
57+ assets <- withProjectRoot "." $ \root ->
58+ -- `--raw` is not available with old nix-instantiate. It drops quotation
59+ -- marks and trailing newline, so is very convenient for shelling out.
60+ readProcessAndLogStderr Debug $
61+ proc "nix" ["eval", "-f", root, "passthru.staticFilesImpure", "--raw"]
62+ putLog Debug $ "Assets impurely loaded from: " <> assets
63+ runGhcid dotGhciPath $ Just $ unwords
66+ , "(runServeAsset " ++ show assets ++ ")"
68+ , "Frontend.frontend"
56runRepl :: MonadObelisk m => m ()
71runRepl :: MonadObelisk m => m ()
57runRepl = do
72runRepl = do