Add cross compilation

This commit is contained in:
Erwin Boskma 2022-10-10 18:35:50 +02:00
parent 1cbc923e74
commit 68b5d1d151
Signed by: erwin
GPG key ID: 270B20D17394F7E5
2 changed files with 11 additions and 3 deletions

View file

@ -51,6 +51,7 @@ in
}; };
nix-common = { nix-common = {
enable = true; enable = true;
cross-systems = [ "aarch64-linux" ];
}; };
tablet.enable = false; tablet.enable = false;
sound.enable = true; sound.enable = true;

View file

@ -8,8 +8,13 @@ with lib; let
in in
{ {
options.eboskma.nix-common = { options.eboskma.nix-common = {
enable = mkEnableOption "activate nix-common"; enable = mkEnableOption "nix-common";
remote-builders = mkEnableOption "enable remote builders"; remote-builders = mkEnableOption "remote builders";
cross-systems = mkOption {
description = "list of systems to cross compile for";
type = with types; listOf str;
default = [];
};
}; };
imports = [ imports = [
@ -31,7 +36,7 @@ in
buildMachines = mkIf cfg.remote-builders [ buildMachines = mkIf cfg.remote-builders [
{ {
hostName = "loki"; hostName = "loki";
systems = [ "x86_64-linux" ]; systems = [ "x86_64-linux" ] ++ cfg.cross-systems;
maxJobs = 8; maxJobs = 8;
speedFactor = 2; speedFactor = 2;
supportedFeatures = [ "kvm" "big-parallel" "nixos-test" "benchmark" ]; supportedFeatures = [ "kvm" "big-parallel" "nixos-test" "benchmark" ];
@ -61,6 +66,8 @@ in
}; };
}; };
boot.binfmt.emulatedSystems = cfg.cross-systems;
programs.ssh.extraConfig = mkIf cfg.remote-builders '' programs.ssh.extraConfig = mkIf cfg.remote-builders ''
Host loki Host loki
HostName 10.0.0.4 HostName 10.0.0.4