juspay/nix-health

Add a health check to confirm that rosetta was installed

Open

#26 opened on Jul 10, 2024

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Rust (4 forks)github user discovery
enhancementgood first issue

Repository metrics

Stars
 (47 stars)
PR merge metrics
 (PR metrics pending)

Description

Some projects explicitly use x86_64-darwin packages even on ARM macs:

https://github.com/nammayatri/nammayatri/blob/ad935fb58e8dd909a311777b39792c1a40fade01/Backend/nix/services/nammayatri.nix#L292-L296

Without installing rosetta, the dev would see:

image

For this, we need to add a check to verify that Nix can build packages for x86_64-darwin.

It might be worth doing this in a more general fashion, by calling the health check canBuildFor. So nammayatri flake can contain:

{ 
  nix-health.default = {
    can-build-for.systems."aarch64-darwin" = [ "x86_64-darwin" ];
  };
}

Or, if that's an overkill, we can just check that rosetta was installed, which would then look like:

{
  nix-health.default = {
    rosetta = {
      installed = true;
    };
  };
}

https://apple.stackexchange.com/a/464165/5007

Contributor guide