From 3fad7346721514af8bbe457abd61aab97916d2e3 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 16 Dec 2021 07:55:19 -0500 Subject: Fix bild --repl to use the proper hasakell package set --- Biz/Bild.hs | 21 +++++++++++++-------- Biz/Bild.nix | 12 ++++++++---- 2 files changed, 21 insertions(+), 12 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 _ -> diff --git a/Biz/Bild.nix b/Biz/Bild.nix index 6279d2f..eb4821d 100644 --- a/Biz/Bild.nix +++ b/Biz/Bild.nix @@ -16,7 +16,7 @@ let # 44 = lib.strings.stringLength "/nix/store/gia2r9mxhc900y1m97dlmr1g3rm3ich3-" dropNixStore = s: nixpkgs.lib.strings.substring 44 (nixpkgs.lib.strings.stringLength s) s; - haskellDeps = hpkgs: import ./Bild/Deps/Haskell.nix hpkgs; + haskellDeps = import ./Bild/Deps/Haskell.nix; mkGhcPackageSet = nixpkgs.haskell.packages.${ghcCompiler}.ghcWithHoogle; #mkGhcjsPackageSet = nixpkgs.haskell.packages.${ghcjsCompiler}.ghcWithPackages; @@ -29,7 +29,9 @@ let wai # can remove when removed from Biz.Log ]); in rec { - inherit (nixpkgs) lib stdenv pkgs sources; + inherit (nixpkgs) lib stdenv sources; + + inherit mkGhcPackageSet; # a standard nix build for `bild` - this should be the only hand-written # builder we need @@ -135,7 +137,7 @@ in rec { # installPhase = "exit 0"; # } // { env = ghcjs; }; - env = pkgs.mkShell { + env = nixpkgs.pkgs.mkShell { name = "bizdev"; buildInputs = with nixpkgs.pkgs; [ # this should just be dev tools @@ -163,5 +165,7 @@ in rec { os = cfg: (nixpkgs.nixos (args: cfg)).toplevel; - image = pkgs.dockerTools.buildImage; + pkgs = { inherit (nixpkgs) git; }; + + image = nixpkgs.pkgs.dockerTools.buildImage; } -- cgit v1.2.3