on master help sign in
Use setCwd and relative paths in findProjectAssets
commit63b9ff58d9b757db5baf39d14155831ddbd0faec authorMatthew Bauer <mjbauer95@gmail.com> dateTue 11 Feb 2020, 16:55 (7 years ago) parent5396971
1 file changed+4−5
lib/command/src/Obelisk/Command/Project.hs+4−5
lib/command/src/Obelisk/Command/Project.hs+4−5
@@ -311,11 +311,10 @@ projectShell root isPure shellName command = do
311311
312312findProjectAssets :: MonadObelisk m => FilePath -> m Text
313313findProjectAssets root = do
314− let importableRoot = toNixPath root
315− isDerivation <- readProcessAndLogStderr Debug $
314+ isDerivation <- readProcessAndLogStderr Debug $ setCwd (Just root) $
316315 proc nixExePath
317316 [ "eval"
318− , "(let a = import " <> importableRoot <> " {}; in toString (a.reflex.nixpkgs.lib.isDerivation a.passthru.staticFilesImpure))"
317+ , "(let a = import ./. {}; in toString (a.reflex.nixpkgs.lib.isDerivation a.passthru.staticFilesImpure))"
319318 , "--raw"
320319 -- `--raw` is not available with old nix-instantiate. It drops quotation
321320 -- marks and trailing newline, so is very convenient for shelling out.
@@ -323,9 +322,9 @@ findProjectAssets root = do
323322 -- Check whether the impure static files are a derivation (and so must be built)
324323 if isDerivation == "1"
325324 then fmap T.strip $ readProcessAndLogStderr Debug $ -- Strip whitespace here because nix-build has no --raw option
326− proc nixBuildExePath
325+ setCwd (Just root) $ proc nixBuildExePath
327326 [ "--no-out-link"
328− , "-E", "(import " <> importableRoot <> "{}).passthru.staticFilesImpure"
327+ , "-E", "(import ./. {}).passthru.staticFilesImpure"
329328 ]
330329 else readProcessAndLogStderr Debug $
331330 proc nixExePath ["eval", "-f", root, "passthru.staticFilesImpure", "--raw"]