Merge pull request #262021 from Enzime/linux-builder-cross

linux-builder: support `x86_64-linux` on `aarch64`
This commit is contained in:
Robert Hensing 2023-10-24 14:34:29 +02:00 committed by GitHub
commit 5dfc78a8ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -40,6 +40,7 @@ rec {
otherHostGuestMatrix = {
aarch64-darwin = {
aarch64-linux = "${qemuPkg}/bin/qemu-system-aarch64 -machine virt,gic-version=2,accel=hvf:tcg -cpu max";
inherit (otherHostGuestMatrix.x86_64-darwin) x86_64-linux;
};
x86_64-darwin = {
x86_64-linux = "${qemuPkg}/bin/qemu-system-x86_64 -machine type=q35,accel=hvf:tcg -cpu max";

View File

@ -690,8 +690,8 @@ in
package =
mkOption {
type = types.package;
default = hostPkgs.qemu_kvm;
defaultText = literalExpression "config.virtualisation.host.pkgs.qemu_kvm";
default = if hostPkgs.stdenv.hostPlatform.qemuArch == pkgs.stdenv.hostPlatform.qemuArch then hostPkgs.qemu_kvm else hostPkgs.qemu;
defaultText = literalExpression "if hostPkgs.stdenv.hostPlatform.qemuArch == pkgs.stdenv.hostPlatform.qemuArch then config.virtualisation.host.pkgs.qemu_kvm else config.virtualisation.host.pkgs.qemu";
example = literalExpression "pkgs.qemu_test";
description = lib.mdDoc "QEMU package to use.";
};

View File

@ -233,15 +233,25 @@ impure-cmds // appleSourcePackages // chooseLibs // {
../../nixos/modules/profiles/macos-builder.nix
] ++ modules;
# If you need to override this, consider starting with the right Nixpkgs
# in the first place, ie change `pkgs` in `pkgs.darwin.linux-builder`.
# or if you're creating new wiring that's not `pkgs`-centric, perhaps use the
# macos-builder profile directly.
virtualisation.host = { inherit pkgs; };
nixpkgs.hostPlatform = lib.mkDefault (toGuest stdenv.hostPlatform.system);
};
system = toGuest stdenv.hostPlatform.system;
system = null;
};
in
nixos.config.system.build.macos-builder-installer) { modules = [ ]; };
linux-builder-x86_64 = self.linux-builder.override {
modules = [ { nixpkgs.hostPlatform = "x86_64-linux"; } ];
};
} // lib.optionalAttrs config.allowAliases {
builder = throw "'darwin.builder' has been changed and renamed to 'darwin.linux-builder'. The default ssh port is now 31022. Please update your configuration or override the port back to 22. See https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder"; # added 2023-07-06
});