NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.31k stars 13.54k forks source link

Newsboat requires Rosetta (Intel emulation) on aarch64-darwin #291013

Open heywoodlh opened 6 months ago

heywoodlh commented 6 months ago

Describe the bug

In order to install the newsboat package from nixpkgs on Darwin, Rosetta must be enabled. If not, a build failure occurs (in this snippet I was trying older branches of nixpkgs -- but the same issue happens with nixpkgs-unstable):

❯ nix shell github:nixos/nixpkgs/release-23.05#newsboat
error: builder for '/nix/store/7kcayxwk8khycxw1agmcyfm9vpsqpw4s-bootstrap-tools.drv' failed with exit code 71;
       last 1 log lines:
       > sandbox-exec: execvp() of '/nix/store/0ihnd9fxych0030mxhg50pz0fivzpmmq-sh' failed: Bad CPU type in executable
       For full logs, run 'nix log /nix/store/7kcayxwk8khycxw1agmcyfm9vpsqpw4s-bootstrap-tools.drv'.
error: 1 dependencies of derivation '/nix/store/9kk68yl715mmrg38zd9gc7zpr9qhnm6b-0001-enable-cross-compilation.patch.drv' failed to build
error: 1 dependencies of derivation '/nix/store/688ci29zdwvp83l4r3835lhmwblkcyvq-025899b7b3593dedb0c681e689e57c0e7bbd9b80.patch.drv' failed to build
...

Steps To Reproduce

Steps to reproduce the behavior:

  1. Attempt to install newsboat from nixpkgs on M1 Mac without Rosetta enabled
  2. Observe failure

Expected behavior

The aarch64-darwin app should be able to be built without Rosetta. Or Rosetta should be turned on as part of the installation perhaps.

Additional context

I'll try to see if I can figure out how to fix the build (after I figure out how to uninstall Rosetta :smile:) and submit a PR

Notify maintainers

@dotlambda @nicknovitski

Metadata

❯ nix run nixpkgs#nix-info -- -m
 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.3.0, macOS 14.3.1`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.19.3`
 - nixpkgs: `not found`
dotlambda commented 6 months ago

nix shell github:nixos/nixpkgs/release-23.05#newsboat

I doubt that would fix it but note that 23.05 is not supported anymore.

heywoodlh commented 6 months ago

Yes, see my comment here:

(in this snippet I was trying older branches of nixpkgs -- but the same issue happens with nixpkgs-unstable)

nicknovitski commented 6 months ago

I found some other issues talking about this. As you've found out, it seems like the sh binary used in the darwin stdenv on aarch64 is wrong. see this file here: https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/darwin/bootstrap-files/aarch64-apple-darwin.nix

my local test:

> curl http://tarballs.nixos.org/stdenv-darwin/aarch64/20acd4c4f14040485f40e55c0a76c186aa8ca4f3/sh --silent --output testsh
> file testsh
testsh: Mach-O 64-bit executable x86_64