Mic92 / nixpkgs-review

Review pull-requests on https://github.com/NixOS/nixpkgs
MIT License
380 stars 63 forks source link

`--system $hostSystem` evaluates for $hostSystem, but builds for $buildSystem #259

Closed kamadorueda closed 2 years ago

kamadorueda commented 2 years ago

On NixOS x86_64-linux is very easy to simulate you are an aarch64-linux (just enable binfmt and pass --system to nix), which means you can both evaluate and build for the specified --system

nixpkgs-review honors this --system aarch64-linux flag when evaluating:

$ nix-env --option system aarch64-linux -f /home/kamadorueda/.cache/nixpkgs-review/pr-162549/nixpkgs -qaP --xml --out-path --show-trace $ git merge --no-commit --no-ff bb7a7dcfc49f0362cd39425e59e69f5fb6e320b8 Automatic merge went well; stopped before committing as requested $ nix-env --option system aarch64-linux -f /home/kamadorueda/.cache/nixpkgs-review/pr-162549/nixpkgs -qaP --xml --out-path --show-trace --meta 2 packages updated: python310Packages.aioshelly (1.0.10 → 1.0.11) python39Packages.aioshelly (1.0.10 → 1.0.11)

But does not honor the --system aarch64-linux when building, which means it will build for x86_64-linux (my native arch):

$ nix --experimental-features nix-command build --no-link --keep-going --option build-use-sandbox relaxed -f /home/kamadorueda/.cache/nixpkgs-review/pr-162549/build.nix

It would be awesome to honor the flag when building, since that would allow linux users to review PRs for many architechtures just by changing the flag

kamadorueda commented 2 years ago

Oh sorry, my bad, after it downloaded the dependencies it failed as expected:

error: a 'x86_64-darwin' with features {} is required to build '/nix/store/x573smggyanla81fld67krynnanyl8rq-pytest-hook.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, kvm, nixos-test}

Awesome! Sorry for the noise again