summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2023-08-03 22:39:27 -0400
committerBen Sima <ben@bsima.me>2023-08-03 22:41:16 -0400
commitb8cdef27e76d37f8857e0f93e427eb9119ffb153 (patch)
tree87b52b5335d8481d147eee9fd388f8824e7ebd78 /Biz
parent88af507c33ab32ae23e35bde9cd7fbbc0d534390 (diff)
Add packageSet argument
Diffstat (limited to 'Biz')
-rw-r--r--Biz/Bild.hs10
-rwxr-xr-xBiz/Ide/repl5
2 files changed, 12 insertions, 3 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs
index 5c28964..a538f98 100644
--- a/Biz/Bild.hs
+++ b/Biz/Bild.hs
@@ -245,6 +245,8 @@ data Target = Target
namespace :: Namespace,
-- | Absolute path to file
path :: FilePath,
+ -- | Name of the packageset in Bild.nix to pull langdeps from
+ packageSet :: Text,
-- | Language-specific dependencies, required during compilation
langdeps :: Set Meta.Dep,
-- | Local source files on which this target depends
@@ -424,6 +426,7 @@ analyze hmap ns = case Map.lookup ns hmap of
compiler = Gcc,
builder = Local user,
out = pout,
+ packageSet = "", -- none, or maybe I should make cPackages?
compilerFlags =
concat
[ [o, dir, str absPath]
@@ -450,6 +453,7 @@ analyze hmap ns = case Map.lookup ns hmap of
{ builder = Local user,
wrapper = Nothing,
compiler = Ghc,
+ packageSet = "ghcWith",
compilerFlags =
[ "-Werror",
"-i$src",
@@ -484,6 +488,7 @@ analyze hmap ns = case Map.lookup ns hmap of
{ sysdeps = Set.empty,
wrapper = Nothing,
compiler = Sbcl,
+ packageSet = "sbclWith",
compilerFlags =
map
Text.pack
@@ -517,6 +522,7 @@ analyze hmap ns = case Map.lookup ns hmap of
out = Meta.None,
outPath = outToPath Meta.None,
srcs = Set.singleton absPath,
+ packageSet = "",
..
}
|> Just
@@ -527,6 +533,7 @@ analyze hmap ns = case Map.lookup ns hmap of
{ langdeps = pdep,
sysdeps = psys,
compiler = Guile,
+ packageSet = "guilePackages",
compilerFlags =
[ "compile",
"--r7rs",
@@ -562,6 +569,7 @@ analyze hmap ns = case Map.lookup ns hmap of
Meta.detectOut (Meta.out "//") contentLines |> \out ->
Target
{ langdeps = Set.empty,
+ packageSet = "rustPackages",
wrapper = Nothing,
sysdeps = Set.empty,
compiler = Rustc,
@@ -835,7 +843,7 @@ nixBuild loud Target {..} =
args =
[ argstr "srcs" <| unwords <| map str <| (root </> path) : Set.toList srcs,
argstr "root" <| str root,
- argstr "packageSet" "ghcWith",
+ argstr "packageSet" packageSet,
(argstr "langDeps" <| unwords <| map str <| Set.toList langdeps) <|> mempty,
argstr "name" <| str <| outname out,
argstr "main" <| str path,
diff --git a/Biz/Ide/repl b/Biz/Ide/repl
index 3ed9fa1..0d0a08d 100755
--- a/Biz/Ide/repl
+++ b/Biz/Ide/repl
@@ -29,6 +29,7 @@ fi
langdeps=$(jq --raw-output '.[].langdeps | join(" ")' <<< $json)
sysdeps=$(jq --raw-output '.[].sysdeps | join(" ")' <<< $json)
exts=$(jq --raw-output '.[].namespace.ext' <<< $json | sort | uniq)
+ packageSet=$(jp --raw-output '.[].packageSet' <<< $json)
BILD="(import ${BIZ_ROOT:?}/Biz/Bild.nix {})"
for lib in ${sysdeps[@]}; do
flags+=(--packages "$BILD.private.nixpkgs.${lib}")
@@ -43,7 +44,7 @@ fi
if [ -z ${var+PORT} ]; then
echo "warn: repl: ghci does not support binding to a port"
fi
- flags+=(--packages "$BILD.private.ghcWith (h: with h; [$langdeps])")
+ flags+=(--packages "$BILD.private.$packageSet (h: with h; [$langdeps])")
command=${CMD:-"ghci -i${BIZ_ROOT:?} -ghci-script ${BIZ_ROOT:?}/.ghci ${targets[@]}"}
;;
Scm)
@@ -54,7 +55,7 @@ fi
command=${CMD:-"guile -L ${BIZ_ROOT:?} -C ${BIZ_ROOT:?}/_/int --r7rs --listen=${PORT:-37146}"}
;;
Lisp)
- flags+=(--packages "$BILD.private.sbclWith (p: with p; [asdf swank $langdeps])")
+ flags+=(--packages "$BILD.private.$packageSet (p: with p; [asdf swank $langdeps])")
command=${CMD:-"sbcl --eval '(require :asdf)' --eval '(require :swank)' --eval '(swank:create-server :port ${PORT:-4005})' --load $targets"}
;;
Rs)