diff options
-rw-r--r-- | Biz/Bild.hs | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs index 7bce4e9..2ec0c7f 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -241,14 +241,16 @@ move args = build isTest isLoud jobs (cpus nproc) targets cpus :: Int -> Int cpus nproc = - Cli.getArgWithDefault args (str <| (nproc - 4) `div` jobs) (Cli.longOption "cpus") + Cli.longOption "cpus" + |> Cli.getArgWithDefault args (str <| (nproc - 4) `div` jobs) |> readMaybe |> \case Nothing -> panic "could not read --cpus argument" Just n -> n jobs :: Int jobs = - Cli.getArgWithDefault args "6" (Cli.longOption "jobs") + Cli.longOption "jobs" + |> Cli.getArgWithDefault args "6" |> readMaybe |> \case Nothing -> panic "could not read --jobs argument" @@ -313,15 +315,16 @@ bild Usage: bild test bild [options] <target>... + bild --help Options: - --test, -t Run tests on a target after building - --loud, -l Show all output from compiler - --plan, -p Print the build plan as JSON, don't build - --time N Set timeout to N minutes, 0 means never timeout [default: 10] - --jobs, -j Number of jobs to build at once [default: 6] - --cpus, -c Number of cpu cores to use per job [default: (nproc-4)/jobs] - --help, -h Print this info + --test, -t Run tests on a target after building + --loud, -l Show all output from compiler + --plan, -p Print the build plan as JSON, don't build + --time N Set timeout to N minutes, 0 means never timeout [default: 10] + --jobs N, -j N Build up to N jobs at once [default: 6] + --cpus N, -c N Allocate up to N cpu cores per job (default: (nproc-4)/jobs) + --help, -h Print this info |] exitSummary :: [Exit.ExitCode] -> IO () @@ -919,7 +922,13 @@ build andTest loud jobs cpus analysis = pure (Exit.ExitSuccess, mempty) NixBuild -> do Log.info ["bild", "nix", user <> "@" <> host, nschunk namespace] - proc loud namespace (toNixFlag compiler) compilerFlags + proc loud namespace (toNixFlag compiler) + <| compilerFlags + ++ [ "--max-jobs", + Text.pack <| str jobs, + "--cores", + Text.pack <| str cpus + ] Copy -> do Log.warn ["bild", "copy", "not implemented yet", nschunk namespace] pure (Exit.ExitSuccess, mempty) |