From 68b5d1d151474bc644e36d3ed43e75b07757a0ab Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Mon, 10 Oct 2022 18:35:50 +0200 Subject: [PATCH] Add cross compilation --- machines/loki/configuration.nix | 1 + modules/nix-common/default.nix | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/machines/loki/configuration.nix b/machines/loki/configuration.nix index 25d908f..4c73eab 100644 --- a/machines/loki/configuration.nix +++ b/machines/loki/configuration.nix @@ -51,6 +51,7 @@ in }; nix-common = { enable = true; + cross-systems = [ "aarch64-linux" ]; }; tablet.enable = false; sound.enable = true; diff --git a/modules/nix-common/default.nix b/modules/nix-common/default.nix index eec70a6..0fca52d 100644 --- a/modules/nix-common/default.nix +++ b/modules/nix-common/default.nix @@ -8,8 +8,13 @@ with lib; let in { options.eboskma.nix-common = { - enable = mkEnableOption "activate nix-common"; - remote-builders = mkEnableOption "enable remote builders"; + enable = mkEnableOption "nix-common"; + remote-builders = mkEnableOption "remote builders"; + cross-systems = mkOption { + description = "list of systems to cross compile for"; + type = with types; listOf str; + default = []; + }; }; imports = [ @@ -31,7 +36,7 @@ in buildMachines = mkIf cfg.remote-builders [ { hostName = "loki"; - systems = [ "x86_64-linux" ]; + systems = [ "x86_64-linux" ] ++ cfg.cross-systems; maxJobs = 8; speedFactor = 2; 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 '' Host loki HostName 10.0.0.4