on master help sign in
Use --no-out-link with nix-build
commit87abcaaf3bf27aeaf75ef4c4c308c682a8cc9d6b authorElliot Cameron <eacameron@gmail.com> dateFri 5 Jul 2019, 15:51 (7 years ago) parent52b3cac
3 files changed+16−11
lib/command/src/Obelisk/Command/Run.hs+4−1 lib/command/src/Obelisk/Command/VmBuilder.hs+2−1 lib/selftest/src/Obelisk/SelfTest.hs+10−9
lib/command/src/Obelisk/Command/Run.hs+4−1
@@ -69,7 +69,10 @@ run = do
6969 -- Check whether the impure static files are a derivation (and so must be built)
7070 if isDerivation == "1"
7171 then fmap T.strip $ readProcessAndLogStderr Debug $ -- Strip whitespace here because nix-build has no --raw option
72− proc "nix-build" ["-E", "(import " <> importablePath root <> "{}).passthru.staticFilesImpure"]
72+ proc "nix-build"
73+ [ "--no-out-link"
74+ , "-E", "(import " <> importablePath root <> "{}).passthru.staticFilesImpure"
75+ ]
7376 else readProcessAndLogStderr Debug $
7477 proc "nix" ["eval", "-f", root, "passthru.staticFilesImpure", "--raw"]
7578 putLog Debug $ "Assets impurely loaded from: " <> assets
lib/command/src/Obelisk/Command/VmBuilder.hs+2−1
@@ -156,7 +156,8 @@ testLinuxBuild stateDir
156156 | System.Info.os == "linux" = failWith "Using the docker builder is not necessary on linux."
157157 | otherwise = do
158158 (exitCode, _stdout, stderr) <- readCreateProcessWithExitCode $ proc "nix-build"
159− [ "-E", "(import <nixpkgs> { system = \"x86_64-linux\"; }).writeText \"test\" builtins.currentTime"
159+ [ "--no-out-link"
160+ , "-E", "(import <nixpkgs> { system = \"x86_64-linux\"; }).writeText \"test\" builtins.currentTime"
160161 , "--builders", nixBuildersArgString stateDir
161162 ]
162163 unless (exitCode == ExitSuccess) $ do
lib/selftest/src/Obelisk/SelfTest.hs+10−9
@@ -74,6 +74,7 @@ main = do
7474 unless isVerbose $
7575 putStrLn "Tests may take longer to run if there are unbuilt derivations: use -v for verbose output"
7676 let verbosity = bool silently verbosely isVerbose
77+ nixBuild args = run "nix-build" ("--no-out-link" : args)
7778 obeliskImpl <- fromString <$> getEnv "OBELISK_IMPL"
7879 httpManager <- HTTP.newManager HTTP.defaultManagerSettings
7980 [p0, p1, p2, p3] <- liftIO $ getFreePorts 4
@@ -138,22 +139,22 @@ main = do
138139 testObRunInDir p2 p3 (Just "frontend") httpManager
139140
140141 describe "obelisk project" $ parallel $ do
141− it "can build obelisk command" $ inTmpObInit $ \_ -> run "nix-build" ["-A", "command" , obeliskImpl]
142− it "can build obelisk skeleton" $ inTmpObInit $ \_ -> run "nix-build" ["-A", "skeleton", obeliskImpl]
143− it "can build obelisk shell" $ inTmpObInit $ \_ -> run "nix-build" ["-A", "shell", obeliskImpl]
142+ it "can build obelisk command" $ inTmpObInit $ \_ -> nixBuild ["-A", "command" , obeliskImpl]
143+ it "can build obelisk skeleton" $ inTmpObInit $ \_ -> nixBuild ["-A", "skeleton", obeliskImpl]
144+ it "can build obelisk shell" $ inTmpObInit $ \_ -> nixBuild ["-A", "shell", obeliskImpl]
144145 -- See https://github.com/obsidiansystems/obelisk/issues/101
145− -- it "can build everything" $ shelly_ $ run "nix-build" [obeliskImpl]
146+ -- it "can build everything" $ shelly_ $ nixBuild [obeliskImpl]
146147
147148 describe "blank initialized project" $ parallel $ do
148149
149150 it "can build ghc.backend" $ inTmpObInit $ \_ -> do
150− run "nix-build" ["--no-out-link", "-A", "ghc.backend"]
151+ nixBuild ["-A", "ghc.backend"]
151152 it "can build ghcjs.frontend" $ inTmpObInit $ \_ -> do
152− run "nix-build" ["--no-out-link", "-A", "ghcjs.frontend"]
153+ nixBuild ["-A", "ghcjs.frontend"]
153154
154155 if os == "darwin"
155− then it "can build ios" $ inTmpObInit $ \_ -> run "nix-build" ["--no-out-link", "-A", "ios.frontend" ]
156− else it "can build android" $ inTmpObInit $ \_ -> run "nix-build" ["--no-out-link", "-A", "android.frontend"]
156+ then it "can build ios" $ inTmpObInit $ \_ -> nixBuild ["-A", "ios.frontend"]
157+ else it "can build android" $ inTmpObInit $ \_ -> nixBuild ["-A", "android.frontend"]
157158
158159 forM_ ["ghc", "ghcjs"] $ \compiler -> do
159160 let
@@ -163,7 +164,7 @@ main = do
163164 it ("can build in " <> shell) $ inTmpObInit $ \_ -> inShell $ "cabal new-build --" <> fromString compiler <> " all"
164165
165166 it "can build reflex project" $ inTmpObInit $ \_ -> do
166− run "nix-build" []
167+ nixBuild []
167168
168169 it "has idempotent thunk update" $ inTmpObInit $ \_ -> do
169170 u <- update