@@ -26,16 +26,19 @@ import Hpack.Config
2626import Hpack.Render
2727import Hpack.Yaml
2828import Language.Haskell.Extension
29−import Network.Socket
29+import Network.Socket hiding (Debug)
3030import System.Directory
3131import System.FilePath
32+import System.Process (proc)
3233import System.IO.Temp (withSystemTempDirectory)
3334import Data.ByteString (ByteString)
3435
3536import Obelisk.App (MonadObelisk, ObeliskT)
36−import Obelisk.CliApp (CliT (..), HasCliConfig, Severity (..), callCommand, failWith, getCliConfig, putLog,
37− runCli)
38−import Obelisk.Command.Project (inProjectShell)
37+import Obelisk.CliApp
38+ ( CliT (..), HasCliConfig, Severity (..)
39+ , callCommand, failWith, getCliConfig, putLog
40+ , readProcessAndLogStderr, runCli)
41+import Obelisk.Command.Project (inProjectShell, withProjectRoot)
3942
4043data CabalPackageInfo = CabalPackageInfo
4144 { _cabalPackageInfo_packageRoot :: FilePath
@@ -51,7 +54,19 @@ run = do
5154 pkgs <- getLocalPkgs
5255 withGhciScript pkgs $ \dotGhciPath -> do
5356 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
64+ [ "run"
65+ , show freePort
66+ , "(runServeAsset " ++ show assets ++ ")"
67+ , "Backend.backend"
68+ , "Frontend.frontend"
69+ ]
5570
5671runRepl :: MonadObelisk m => m ()
5772runRepl = do