@@ -23,7 +23,6 @@ import Data.Map (Map)
2323import qualified Data.Map as Map
2424import Data.Maybe
2525import qualified Data.Set as Set
26−import Data.String.Here (hereLit)
2726import Data.Text (Text)
2827import qualified Data.Text as T
2928import Data.Time.Clock (getCurrentTime)
@@ -97,9 +96,9 @@ profile profileBasePattern rtsFlags = withProjectRoot "." $ \root -> do
9796 exePath <- nixCmd $ NixCmd_Build $ def
9897 & nixBuildConfig_outLink .~ OutLink_None
9998 & nixCmdConfig_target .~ Target
100− { _target_path = Nothing
101− , _target_attr = Nothing
102− , _target_expr = Just nixBuildExpr }
99+ { _target_path = Just "."
100+ , _target_attr = Just "profiledObRun"
101+ , _target_expr = Nothing }
103102 assets <- findProjectAssets root
104103 putLog Debug $ "Assets impurely loaded from: " <> assets
105104 freePort <- getFreePort
@@ -112,33 +111,6 @@ profile profileBasePattern rtsFlags = withProjectRoot "." $ \root -> do
112111 ] <> rtsFlags
113112 <> [ "-RTS" ]
114113 void $ waitForProcess ph
115− where
116− nixBuildExpr = [hereLit|
117−with (import ./. {});
118−let
119− exeSource = obelisk.nixpkgs.writeText "ob-run" ''
120−module Main where
121−
122−import Control.Exception
123−import Reflex.Profiled
124−import System.Environment
125−
126−import qualified Obelisk.Run
127−import qualified Frontend
128−import qualified Backend
129−
130−main :: IO ()
131−main = do
132− args <- getArgs
133− let port = read $ args !! 0
134− assets = args !! 1
135− profileFile = (args !! 2) <> ".rprof"
136− Obelisk.Run.run port (Obelisk.Run.runServeAsset assets) Backend.backend Frontend.frontend `finally` writeProfilingData profileFile
137− '';
138−in obelisk.nixpkgs.runCommand "ob-run" {
139− buildInputs = [ (profiled.ghc.ghcWithPackages (p: [ p.backend p.frontend])) ];
140−} "ghc -x hs -prof -fno-prof-auto -threaded ${exeSource} -o $out"
141−|]
142114
143115run
144116 :: MonadObelisk m