diff options
author | Ben Sima <ben@bsima.me> | 2023-08-17 17:28:03 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-08-17 22:43:38 -0400 |
commit | cc6aac612e36da3c9b9b4e47fc16ed512a79f2d9 (patch) | |
tree | e32cfb60890c4293465c34d31c5771882b7fcb02 /Biz/Bild.hs | |
parent | 204ccb2bcab7b6fa8fb4d8a26e65c591ae075343 (diff) |
Nixify rust build
Not getting deps yet but thats okay, I basically need to do a bunch of annoying
nix work to get rustPackages into a thing like pythonPackages.
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r-- | Biz/Bild.hs | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs index a9988d5..81947ed 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -458,7 +458,7 @@ analyze hmap ns = case Map.lookup ns hmap of outPath = outToPath pout, out = pout, srcs = Set.singleton path, - packageSet = "pythonWith", + packageSet = "pythonPackages", .. } |> Just @@ -514,7 +514,7 @@ analyze hmap ns = case Map.lookup ns hmap of { builder = Local user host, wrapper = Nothing, compiler = Ghc, - packageSet = "ghcWith", + packageSet = "ghcPackages", compilerFlags = [ "-Werror", "-threaded", @@ -631,16 +631,28 @@ analyze hmap ns = case Map.lookup ns hmap of |> Just |> pure Namespace.Rs -> - Meta.detectOut (Meta.out "//") contentLines |> \out -> + Meta.detectAll "//" contentLines |> \Meta.Parsed {..} -> Target - { langdeps = Set.empty, + { langdeps = pdep, + -- this packageSet doesn't actually exist because everyone in + -- nix just generates nix expressions for rust dependencies with + -- Cargo.lock, so I have to make it in order to use rust deps packageSet = "rustPackages", wrapper = Nothing, - sysdeps = Set.empty, + sysdeps = psys <> Set.singleton "rustc", + out = pout, compiler = Rustc, - compilerFlags = map Text.pack [absPath, "-o", root </> outToPath out], + compilerFlags = case pout of + Meta.Bin o -> + map + Text.pack + [ "$BIZ_ROOT" </> path, + "-o", + o + ] + _ -> panic "can't build rust libs", builder = Local user host, - outPath = outToPath out, + outPath = outToPath pout, srcs = Set.singleton absPath, .. } @@ -776,9 +788,9 @@ build andTest loud analysis = Copy -> do Log.warn ["bild", "copy", "not implemented yet", nschunk namespace] pure (Exit.ExitSuccess, mempty) - Rustc -> do + Rustc -> Log.info ["bild", "dev", "rust", nschunk namespace] - proc loud namespace (toNixFlag compiler) compilerFlags + >> nixBuild loud target Sbcl -> do Log.info ["bild", "dev", "lisp", nschunk namespace] proc loud namespace (toNixFlag compiler) compilerFlags @@ -962,6 +974,7 @@ nixBuild loud Target {..} = selectBuilder :: Namespace -> Text selectBuilder = \case - Namespace _ Namespace.Hs -> "base" + Namespace _ Namespace.Hs -> "haskell" Namespace _ Namespace.Py -> "python" - _ -> panic "no builder for this namespace" + Namespace _ Namespace.Rs -> "base" + Namespace _ ext -> panic <| "no builder for " <> show ext |