Stream: haskell-flake

Topic: OOM during compilation?


view this post on Zulip JamesM (Jul 03 2024 at 12:27):

My builds are failing and it seems to be because cabal builds multiple packages in parallel and runs out of memory. I've had this issue before when using Docker and solved it by passing -j1 to cabal build. How do I do the same using haskell-flake?

I tried sprinkling extraBuildFlags with "-j1" everywhere to see if it'd have an effect, but it seems it does not. I'm new to nix and haskell-flake so I'm sure I'm using it incorrectly.

How would I pass a "global" cabal build flag like this?

Here's my flake:

{
  inputs = {
    nixpkgs.url = "github:nixos//nixpkgs/00d80d13810dbfea8ab4ed1009b09100cca86ba8";
    flake-parts.url = "github:hercules-ci/flake-parts";
    haskell-flake.url = "github:srid/haskell-flake";
  };
  outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      systems = nixpkgs.lib.systems.flakeExposed;
      imports = [ inputs.haskell-flake.flakeModule ];
      perSystem = { self', system, lib, config, pkgs, ... }: {
        haskellProjects.default = {
          basePackages = pkgs.haskell.packages.ghc982;

          settings = {
            all.extraBuildFlags = [ "-j1" ];
            overall.extraBuildFlags = [ "-j1" ];
          };

          devShell = {
            hlsCheck.enable = false;
          };

          defaults.settings.default = {
            check = false;
            extraBuildFlags = [ "-j1" ];
          };

          autoWire = [ "packages" ];
        };

        packages.default = self'.packages.overall;

        devShells.default = pkgs.mkShell {
          name = "Haskell devShell";
          inputsFrom = [
            config.haskellProjects.default.outputs.devShell
          ];
          nativeBuildInputs = with pkgs; [
          ];
        };
      };
    };
}

view this post on Zulip Srid (Jul 03 2024 at 14:26):

          settings = {
            all.extraBuildFlags = [ "-j1" ];
            overall.extraBuildFlags = [ "-j1" ];
          };

What's all and overall? Are you using latest haskell-flake?

view this post on Zulip Srid (Jul 03 2024 at 14:28):

          defaults.settings.default = {
            check = false;
            extraBuildFlags = [ "-j1" ];
          };

In recent haskell-flake, this should be defaults.settings.local


Last updated: Sep 16 2024 at 19:45 UTC