diff options
author | Ben Sima <ben@bsima.me> | 2021-12-16 07:55:19 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2021-12-21 11:01:54 -0500 |
commit | 3fad7346721514af8bbe457abd61aab97916d2e3 (patch) | |
tree | 1ed071f885fa34784884cf6451c7a11381915cdc /Biz/Bild.hs | |
parent | d62b0be79cb80d020a2354b3e09d451848e492a1 (diff) |
Fix bild --repl to use the proper hasakell package set
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r-- | Biz/Bild.hs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs index 4d7fadd..845daf1 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -469,18 +469,23 @@ test loud Target {..} = case compiler of >> pure Exit.ExitSuccess repl :: Bool -> Target -> IO Exit.ExitCode -repl _ Target {..} = +repl _ Target {..} = do + root <- Env.getEnv "BIZ_ROOT" case compiler of c | c `elem` [GhcExe, GhcLib] -> - [ ["--packages"], - ["haskellPackages." <> d | d <- Set.toList langdeps], - Set.toList sysdeps, - [ "--command", - "ghci -i$BIZ_ROOT -ghci-script $BIZ_ROOT/.ghci " <> path - ] + -- this is a complicated set of string joins which basically means to + -- create a command like this: + -- nix-shell -E "with import Biz/Bild.nix {}; mkGhcPackageSet (h: [h.pkg])" + [ "--expr", + "with import " <> root <> "/Biz/Bild.nix {};" + <> "mkGhcPackageSet (h: [" + <> joinWith " " ["h." <> d | d <- Set.toList langdeps] + <> "])", + -- Set.toList sysdeps, + "--command", + "ghci -i$BIZ_ROOT -ghci-script $BIZ_ROOT/.ghci " <> path ] - |> mconcat |> Process.callProcess "nix-shell" >> Exit.exitSuccess _ -> |