Disable checks in a haskell package when using an overlay

I want to get rid of that error by disabling the checks in an overlay when building sdimage for a raspberry pi 2 - see configuration.nix attached, please.

How would that work ? As of now the test suite is run and fails nonetheless.

nix command

nix build --builders "ssh://eu.nixbuild.net armv7l-linux - 100 1 big-parallel,benchmark" --max-jobs 0 --system armv7l-linux .#nixosConfigurations.armv7l.linux.raspi2.config.system.build.sdImage -L -vvv --show-trace

flake.nix
{
  inputs = {
    nixos-generators.url = "github:nix-community/nixos-generators";
    nixos-hardware.url = "github:NixOS/nixos-hardware/master";
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
    systems.url = "github:nix-systems/default";
    treefmt-nix = {
      url = "github:numtide/treefmt-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    self,
    nixpkgs,
    treefmt-nix,
    systems,
    ...
  } @ inputs: let
    rootPath = self;
    system = "armv7l-linux";
    eachSystem = f:
      nixpkgs.lib.genAttrs (import systems) (
        system:
          f nixpkgs.legacyPackages.${system}
      );
    treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
  in {
    nixosConfigurations.${system}.raspi2 = inputs.nixpkgs.lib.nixosSystem {
      specialArgs = {
        inherit inputs rootPath;
      };

      modules = [
        "${rootPath}/configuration.nix"
      ];
    };

    formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
  };
}
configuration.nix
{
  pkgs,
  lib,
  rootPath,
  ...
}:
# build: nix build --builders "ssh://eu.nixbuild.net armv7l-linux - 100 1 big-parallel,benchmark" --max-jobs 0 --system armv7l-linux .#nixosConfigurations.armv7l-linux.raspi2.config.system.build.sdImage -L -vvv --show-trace
{
  imports = ["${rootPath}/hardware/pi2.nix"];

  networking.useDHCP = lib.mkDefault true;

  # modules/users.nix - https://blog.yaymukund.com/posts/nixos-raspberry-pi-nixbuild-headless/
  users.users.dani = {
    isNormalUser = true;
    home = "/home/dani";
    extraGroups = [
      "wheel"
      "networkmanager"
      "audio"
      "video"
    ];
    password = "test";
  };

  security.sudo.execWheelOnly = true;

  security.sudo.extraRules = [
    {
      users = ["dani"];
      commands = [
        {
          command = "ALL";
          options = ["NOPASSWD"];
        }
      ];
    }
  ];

  # modules/networking.nix
  networking = {
    useNetworkd = true;
    hostName = "testpi";
  };

  programs.ssh.startAgent = true;
  services.openssh = {
    enable = true;
    settings = {
      PasswordAuthentication = false;
      KbdInteractiveAuthentication = false;
    };
  };

  users.users."dani".openssh.authorizedKeys.keyFiles = [
  ];

  # modules/builder.nix
  boot.tmp.useTmpfs = true;
  boot.tmp.tmpfsSize = "50%";

  zramSwap.enable = true;
  zramSwap.memoryPercent = 150;

  swapDevices = [
    {
      device = "/swapfile";
      size = 2048;
    }
  ];

  services.getty.helpLine = ''
    \e[0;93mReset password now, please !\e[0m
    Issue \e[0;32mcat /etc/issue\e[0m to show these messages again
  '';

  console = {
    useXkbConfig = true;
    packages = [pkgs.terminus_font];
  };

  services.xserver = {
    enable = false;
    xkb.layout = "us";
    xkb.variant = "intl";
  };

  systemd.network.wait-online.timeout = 0;
  systemd.network.networks = {
    "10-ethernet-api-dhcp" = {
      enable = true;
      matchConfig.Name = "eth0";
      dhcpV4Config.RouteMetric = 20;
      networkConfig.DHCP = "yes";
      linkConfig.RequiredForOnline = "no";
      ipv6AcceptRAConfig.RouteMetric = 20;
    };
  };

  environment.systemPackages = builtins.attrValues {
    inherit
      (pkgs)
      pciutils
      usbutils
      ethtool
      lshw
      nmap
      ;
  };

  system.stateVersion = lib.mkForce "24.05";

  # https://discourse.nixos.org/t/help-using-a-nixpkgs-overlay-in-a-flake/46075/7
  nixpkgs.overlays = [
    (final: prev: {
      # https://discourse.nixos.org/t/trying-to-make-a-libreoffice-overlay-to-skip-checks-because-i-want-to-complicate-my-life/48708
      haskellPackages = prev.haskellPackages.override {
        overrides = hsSelf: hsSuper: {
          time-compat = prev.haskell.lib.overrideCabal hsSuper.time-compat (oa: {
            doCheck = false;
          });
        };
      };
    })
  ];
}
hardware/pi2.nix
{
  pkgs,
  lib,
  inputs,
  modulesPath,
  ...
}: {
  imports = [
    inputs.nixos-hardware.nixosModules.raspberry-pi-2
    (modulesPath + "/installer/scan/not-detected.nix")
    (modulesPath + "/installer/sd-card/sd-image-armv7l-multiplatform-installer.nix")
  ];

  boot = {
    initrd.availableKernelModules = ["xhci_pci"];
    kernelParams = [
      "compat_uts_machine=armv7l"
    ];

    # error: Package ‘zfs-kernel-2.2.7-6.13.1’ in /nix/store/5bni29qxcvbqygs8asgzd7gf5vvrs6ay-source/pkgs/os-specific/linux/zfs/generic.nix:309 is marked as broken, refusing to evaluate.
    kernelPackages = lib.mkForce pkgs.zfs.latestCompatibleLinuxPackages;
    kernelPatches = [
      {
        name = "disable-bpf";
        patch = null;
        extraConfig = ''
          DEBUG_INFO_BTF n
          CONFIG_DEBUG_INFO_BTF n
        '';
      }

      # https://discourse.nixos.org/t/cannot-build-arm-linux-kernel-on-an-actual-arm-device/54218/13
      {
        name = "compat_uts_machine";
        patch = pkgs.fetchpatch {
          url = "https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy/patch/?id=c1da50fa6eddad313360249cadcd4905ac9f82ea";
          sha256 = "sha256-357+EzMLLt7IINdH0ENE+VcDXwXJMo4qiF/Dorp2Eyw=";
        };
      }
    ];
  };

  nix.extraOptions = "extra-platforms = armv7l-linux";
  nixpkgs.hostPlatform = lib.mkDefault "armv7l-linux";
  swapDevices = [];
}

Overlays still such a mind blow to me, see this “Build with /nix/store/nknkgmiwm6fr2jc6xlsifi7arz7ny6la-ghc-9.2.8.” line in the build output of the concerned package.

Based on this I decided to give the following a shot based on the gist linked here:

nixpkgs.overlays = [
    (final: prev: {
      haskell = prev.haskell // {
        packages = prev.haskell.packages // {
          ghc928 = prev.haskell.packages.ghc928.override {
            overrides = hsSelf: hsSuper: {
              time-compat = prev.haskell.lib.dontCheck hsSuper.time-compat;
            };
          };
        };
      };
    })
];

Et voilà it works.

Furthermore disabling the firewall (networking.firewall.enable = false in configuration.nix) let me even finish the build of the sd_image successfully.

Needed due to unordered-containers build hanging which might be related to haskellPackages.unordered-containers: disable hanging tests on 32bit by sternenseemann · Pull Request #359690 · NixOS/nixpkgs · GitHub, latter which fix is not backported to 24.05 release.