Compare commits

..

2 Commits

Author SHA1 Message Date
282ef0f8d3 cross: fix enableParallelBuilding to work 2023-08-05 09:04:02 +00:00
45578b2f00 build bonsai/hare/qbe without relying on binfmt emulation 2023-08-05 08:05:50 +00:00
4 changed files with 12 additions and 21 deletions

View File

@@ -94,17 +94,7 @@
evalHost = { name, local, target }: nixpkgs.lib.nixosSystem {
system = target;
modules = [
{
nixpkgs = (if (local != null) then {
buildPlatform = local;
} else {}) // {
# TODO: does the earlier `system` arg to nixosSystem make its way here?
hostPlatform.system = target;
};
# nixpkgs.buildPlatform = local; # set by instantiate.nix instead
# nixpkgs.config.replaceStdenv = { pkgs }: pkgs.ccacheStdenv;
}
(import ./hosts/instantiate.nix { hostName = name; })
(import ./hosts/instantiate.nix { localSystem = local; hostName = name; })
self.nixosModules.default
self.nixosModules.passthru
{
@@ -113,6 +103,12 @@
self.overlays.sane-all
];
}
({ lib, ... }: {
# TODO: does the earlier `system` arg to nixosSystem make its way here?
nixpkgs.hostPlatform.system = target;
# nixpkgs.buildPlatform = local; # set by instantiate.nix instead
# nixpkgs.config.replaceStdenv = { pkgs }: pkgs.ccacheStdenv;
})
];
};
in {

View File

@@ -1,10 +1,10 @@
# trampoline from flake.nix into the specific host definition, while doing a tiny bit of common setup
# args from flake-level `import`
{ hostName }:
{ hostName, localSystem }:
# module args
{ ... }:
{ lib, ... }:
{
imports = [
@@ -14,4 +14,5 @@
];
networking.hostName = hostName;
nixpkgs.buildPlatform = lib.mkIf (localSystem != null) localSystem;
}

View File

@@ -15,15 +15,9 @@
patchedFlakeFor = system: import "${patchedPkgsFor system}/flake.nix";
patchedFlakeOutputsFor = system:
(patchedFlakeFor system).outputs { inherit self; };
extractBuildPlatform = nixosSystemArgs:
let
firstMod = builtins.head nixosSystemArgs.modules;
in
firstMod.nixpkgs.buildPlatform or nixosSystemArgs.system;
in
{
lib.nixosSystem = args: (patchedFlakeOutputsFor (extractBuildPlatform args)).lib.nixosSystem args;
lib.nixosSystem = args: (patchedFlakeOutputsFor args.system).lib.nixosSystem args;
legacyPackages = builtins.mapAttrs
(system: _:

View File

@@ -89,7 +89,7 @@ let
# so hack its components into something which *does* handle cross compilation
lib.overrideDerivation binfmtDeriv ({ builder, args, ... }: {
builder = "${final.buildPackages.bash}/bin/sh";
args = ["-e" (final.buildPackages.vmTools.vmRunCommand qemuCommandLinux)];
args = ["-e" (final.vmTools.vmRunCommand qemuCommandLinux)];
# orig{Builder,Args} gets used by the vmRunCommand script:
origBuilder = builder;
origArgs = args;