diff options
author | Ben Sima <ben@bsima.me> | 2023-08-03 22:25:06 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-08-03 22:38:28 -0400 |
commit | 88af507c33ab32ae23e35bde9cd7fbbc0d534390 (patch) | |
tree | 0aef964b759d518806dafd6495e473d5206044eb | |
parent | 40c6c18e57d88b101bd4396d48aefa681689bfb3 (diff) |
Move buildPhase to a nix-instantiate argument
-rw-r--r-- | Biz/Bild.hs | 19 | ||||
-rw-r--r-- | Biz/Bild/Builder.nix (renamed from Biz/Bild/Haskell.nix) | 6 |
2 files changed, 11 insertions, 14 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs index d20c46e..5c28964 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -835,17 +835,16 @@ nixBuild loud Target {..} = args = [ argstr "srcs" <| unwords <| map str <| (root </> path) : Set.toList srcs, argstr "root" <| str root, - argstr "packageSet" "ghcWith" + argstr "packageSet" "ghcWith", + (argstr "langDeps" <| unwords <| map str <| Set.toList langdeps) <|> mempty, + argstr "name" <| str <| outname out, + argstr "main" <| str path, + argstr "mainIs" <| str <| Namespace.toHaskellModule namespace, + argstr "buildPhase" <| unwords + <| (Text.pack <| toNixFlag compiler) : + compilerFlags, + [str <| root </> "Biz/Bild/Builder.nix"] ] - ++ (langdeps == mempty) - ?: ( [], - [argstr "langDeps" <| unwords <| map str <| Set.toList langdeps] - ) - ++ [ argstr "name" <| str <| outname out, - argstr "main" <| str path, - argstr "mainIs" <| str <| Namespace.toHaskellModule namespace, - [str <| root </> "Biz/Bild/Haskell.nix"] - ] |> mconcat |> map Text.unpack, onFailure = Log.fail ["bild", "instantiate", nschunk namespace] >> Log.br, diff --git a/Biz/Bild/Haskell.nix b/Biz/Bild/Builder.nix index 24b6686..a0ed17c 100644 --- a/Biz/Bild/Haskell.nix +++ b/Biz/Bild/Builder.nix @@ -5,6 +5,7 @@ , name # exe name , main # entrypoint file , mainIs # entrypoint module name +, buildPhase }: with import (/. + root + "/Biz/Bild.nix") {}; with builtins; @@ -24,12 +25,9 @@ let else []; in stdenv.mkDerivation { - inherit name; + inherit name buildPhase; buildInputs = [ (private.${packageSet} deps) ]; src = lib.sources.cleanSourceWith {inherit filter; src = lib.sources.cleanSource root;}; - buildPhase = '' - ghc -Werror -i$src -odir. -hidir. --make $src/${main} -main-is "${mainIs}" -o ${name} - ''; installPhase = '' mkdir -p $out/bin && cp ${name} $out/bin ''; |