linux-builder: support x86_64-linux on aarch64

This commit is contained in:
Michael Hoang 2023-10-19 10:11:07 +01:00
parent 12bdeb01ff
commit ab1f45f3d3
3 changed files with 14 additions and 3 deletions

View file

@ -40,6 +40,7 @@ rec {
otherHostGuestMatrix = { otherHostGuestMatrix = {
aarch64-darwin = { aarch64-darwin = {
aarch64-linux = "${qemuPkg}/bin/qemu-system-aarch64 -machine virt,gic-version=2,accel=hvf:tcg -cpu max"; 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-darwin = {
x86_64-linux = "${qemuPkg}/bin/qemu-system-x86_64 -machine type=q35,accel=hvf:tcg -cpu max"; x86_64-linux = "${qemuPkg}/bin/qemu-system-x86_64 -machine type=q35,accel=hvf:tcg -cpu max";

View file

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

View file

@ -233,15 +233,25 @@ impure-cmds // appleSourcePackages // chooseLibs // {
../../nixos/modules/profiles/macos-builder.nix ../../nixos/modules/profiles/macos-builder.nix
] ++ modules; ] ++ 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; }; virtualisation.host = { inherit pkgs; };
nixpkgs.hostPlatform = lib.mkDefault (toGuest stdenv.hostPlatform.system);
}; };
system = toGuest stdenv.hostPlatform.system; system = null;
}; };
in in
nixos.config.system.build.macos-builder-installer) { modules = [ ]; }; 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 { } // 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 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
}); });