on master help sign in
Use --pure shells for ob run
commita9b237bf1b11fb6875de747bd03a326007a27435 authorElliot Cameron <eacameron@gmail.com> dateTue 19 Nov 2019, 14:09 (7 years ago) parent9d2c23d
3 files changed+6−4
FAQ.md+2−2 lib/command/src/Obelisk/Command.hs+1−1 lib/command/src/Obelisk/Command/Project.hs+3−1
FAQ.md+2−2
@@ -81,7 +81,7 @@ project's dependencies and,
8181Assuming we are in a project created with `ob init`, `ob run` calls (see
8282`lib/command/src/Obelisk/Command.hs`):
8383
84− nix-shell -A shells.ghc --run 'ob --no-handoff internal run-static-io <real-run-function>'
84+ nix-shell --pure --keep NIX_PATH -A shells.ghc --run 'ob --no-handoff internal run-static-io <real-run-function>'
8585
8686where
8787
@@ -109,7 +109,7 @@ It is defined in `lib/run/src/Obelisk/Run.hs`:
109109 * or to `serveDefaultObeliskApp` (`lib/backend/src/Obelisk/Backend.hs`) to
110110 serve static assets.
111111* Starts `runWidget`
112− which itself runs
112+ which itself runs
113113 [runSettingsSocket](https://hackage.haskell.org/package/warp-3.2.26/docs/Network-Wai-Handler-Warp.html#v:runSettingsSocket)
114114 (the *“TCP listen loop”*):
115115 * it binds to TCP socket, and
lib/command/src/Obelisk/Command.hs+1−1
@@ -106,7 +106,7 @@ data ObInternal
106106inNixShell' :: MonadObelisk m => StaticPtr (ObeliskT IO ()) -> m ()
107107inNixShell' p = withProjectRoot "." $ \root -> do
108108 cmd <- liftIO $ unwords <$> mkCmd -- TODO: shell escape instead of unwords
109− projectShell root False "ghc" (Just cmd)
109+ projectShell root True "ghc" (Just cmd)
110110 where
111111 mkCmd = do
112112 argsCfg <- getArgsConfig
lib/command/src/Obelisk/Command/Project.hs+3−1
@@ -206,7 +206,9 @@ projectShell :: MonadObelisk m => FilePath -> Bool -> String -> Maybe String ->
206206projectShell root isPure shellName command = do
207207 (_, _, _, ph) <- createProcess_ "runNixShellAttr" $ setCtlc $ setCwd (Just root) $ proc "nix-shell" $
208208 [ "default.nix"] <>
209− [ "--pure" | isPure ] <>
209+ -- Keep $NIX_PATH in the env for --pure shells so '<nixpkgs>' works in sub-commands
210+ -- TODO: Don't use <nixpkgs> for anything!
211+ (if isPure then [ "--pure", "--keep", "NIX_PATH" ] else []) <>
210212 [ "-A"
211213 , "shells." <> shellName
212214 ] <> case command of