From 5a56dea928ffa181d9a1c15243f80925b4bb133e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Thu, 19 Oct 2023 09:02:43 +0100 Subject: [PATCH 1/2] add cross building support for riscv --- config/instance-20221213-1915.nix | 4 ++ config/nas.nix | 2 + config/nix.nix | 80 +++++++++++++++++++++++++++++++ config/nutty-noon.nix | 2 + config/services/hydra.nix | 2 +- config/vf2.nix | 1 + 6 files changed, 90 insertions(+), 1 deletion(-) diff --git a/config/instance-20221213-1915.nix b/config/instance-20221213-1915.nix index 9f86fff7..7855a851 100644 --- a/config/instance-20221213-1915.nix +++ b/config/instance-20221213-1915.nix @@ -113,6 +113,10 @@ ]; nix.daemonCPUSchedPolicy = "idle"; nix.daemonIOSchedClass = "idle"; + boot.binfmt.emulatedSystems = [ + "riscv32-linux" + "riscv64-linux" + ]; system.stateVersion = "22.11"; diff --git a/config/nas.nix b/config/nas.nix index a8b1c914..5fa1cee4 100644 --- a/config/nas.nix +++ b/config/nas.nix @@ -114,6 +114,8 @@ "powerpc64-linux" "powerpc64le-linux" "wasm32-wasi" + "riscv32-linux" + "riscv64-linux" ]; hardware.enableRedistributableFirmware = true; nix.settings.substituters = lib.mkForce [ diff --git a/config/nix.nix b/config/nix.nix index bbb09bfd..e3cf1220 100644 --- a/config/nix.nix +++ b/config/nix.nix @@ -45,12 +45,92 @@ hostName = "build-aarch64"; systems = [ "aarch64-linux" + "riscv32-linux" + "riscv64-linux" ]; maxJobs = 4; speedFactor = 1; supportedFeatures = ["nixos-test" "benchmark" "ca-derivations" "gccarch-armv8-a" "gccarch-armv8.1-a" "gccarch-armv8.2-a" "big-parallel"]; } ]) + (mkIf (config.networking.hostName != "nas") [ + { + hostName = "build-nas"; + systems = [ + "armv7l-linux" + "powerpc-linux" + "powerpc64-linux" + "powerpc64le-linux" + "wasm32-wasi" + "riscv32-linux" + "riscv64-linux" + ]; + maxJobs = 12; + speedFactor = 1; + supportedFeatures = [ + "kvm" + "nixos-test" + "big-parallel" + "benchmark" + "gccarch-znver1" + "gccarch-skylake" + "ca-derivations" + ]; + } + ]) + (mkIf (config.networking.hostName != "nutty-noon") [ + { + hostName = "build-pc"; + systems = [ + "armv7l-linux" + "powerpc-linux" + "powerpc64-linux" + "powerpc64le-linux" + "wasm32-wasi" + "riscv32-linux" + "riscv64-linux" + ]; + maxJobs = 16; + speedFactor = 1; + supportedFeatures = [ + "kvm" + "nixos-test" + "big-parallel" + "benchmark" + "gccarch-znver2" + "gccarch-znver1" + "gccarch-skylake" + "ca-derivations" + ]; + } + ]) + (mkIf (config.networking.hostName != "vf2") [ + { + hostName = "build-riscv"; + systems = [ + "riscv32-linux" + "riscv64-linux" + ]; + maxJobs = 4; + speedFactor = 2; + supportedFeatures = [ + "nixos-test" + "big-parallel" + "benchmark" + "ca-derivations" + # There are many more combinations but i simply do not care lol + "gccarch-rv64gc_zba_zbb" + "gccarch-rv64gc_zba" + "gccarch-rv64gc_zbb" + "gccarch-rv64gc" + "gccarch-rv32gc_zba_zbb" + "gccarch-rv32gc_zba" + "gccarch-rv32gc_zbb" + "gccarch-rv32gc" + "native-riscv" + ]; + } + ]) ]; distributedBuilds = true; }; diff --git a/config/nutty-noon.nix b/config/nutty-noon.nix index 48e8e8c3..82673701 100644 --- a/config/nutty-noon.nix +++ b/config/nutty-noon.nix @@ -70,6 +70,8 @@ "powerpc64-linux" "powerpc64le-linux" "wasm32-wasi" + "riscv32-linux" + "riscv64-linux" ]; hardware.enableRedistributableFirmware = true; nix.daemonCPUSchedPolicy = "idle"; diff --git a/config/services/hydra.nix b/config/services/hydra.nix index 8310a878..c59c83c5 100644 --- a/config/services/hydra.nix +++ b/config/services/hydra.nix @@ -9,7 +9,7 @@ machines = pkgs.writeText "machines" '' localhost armv7l-linux,powerpc-linux,powerpc64-linux,powerpc64le-linux,wasm32-wasi,x86_64-linux,i686-linux - 12 1 kvm,nixos-test,big-parallel,benchmark,gccarch-znver1,gccarch-skylake,ca-derivations - build-aarch64 aarch64-linux - 4 1 nixos-test,benchmark,ca-derivations,gccarch-armv8-a,gccarch-armv8.1-a,gccarch-armv8.2-a,big-parallel - - build-riscv riscv64-linux,riscv32-linux - 4 1 nixos-test,benchmark,ca-derivations,gccarch-rv64gc_zba_zbb,gccarch-rv64gc_zba,gccarch-rv64gc_zbb,ccarch-rv64gc,gccarch-rv32gc_zba_zbb,gccarch-rv32gc_zba,gccarch-rv32gc_zbb,gccarch-rv32gc,big-parallel - + build-riscv riscv64-linux,riscv32-linux - 4 1 nixos-test,benchmark,ca-derivations,gccarch-rv64gc_zba_zbb,gccarch-rv64gc_zba,gccarch-rv64gc_zbb,ccarch-rv64gc,gccarch-rv32gc_zba_zbb,gccarch-rv32gc_zba,gccarch-rv32gc_zbb,gccarch-rv32gc,big-parallel,native-riscv - ''; sshConfig = pkgs.writeText "ssh-config" '' Host build-aarch64 diff --git a/config/vf2.nix b/config/vf2.nix index adf1bdbc..8d94e8d9 100644 --- a/config/vf2.nix +++ b/config/vf2.nix @@ -97,6 +97,7 @@ "gccarch-rv32gc_zba" "gccarch-rv32gc_zbb" "gccarch-rv32gc" + "native-riscv" ]; nix.daemonCPUSchedPolicy = "idle"; nix.daemonIOSchedClass = "idle"; From 1c581d4b2cca5347cf0cca7267fa815f2c1efc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Thu, 19 Oct 2023 09:04:26 +0100 Subject: [PATCH 2/2] make hydra use the cross builders too --- config/services/hydra.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/services/hydra.nix b/config/services/hydra.nix index c59c83c5..76727130 100644 --- a/config/services/hydra.nix +++ b/config/services/hydra.nix @@ -7,9 +7,9 @@ ... }: let machines = pkgs.writeText "machines" '' - localhost armv7l-linux,powerpc-linux,powerpc64-linux,powerpc64le-linux,wasm32-wasi,x86_64-linux,i686-linux - 12 1 kvm,nixos-test,big-parallel,benchmark,gccarch-znver1,gccarch-skylake,ca-derivations - - build-aarch64 aarch64-linux - 4 1 nixos-test,benchmark,ca-derivations,gccarch-armv8-a,gccarch-armv8.1-a,gccarch-armv8.2-a,big-parallel - - build-riscv riscv64-linux,riscv32-linux - 4 1 nixos-test,benchmark,ca-derivations,gccarch-rv64gc_zba_zbb,gccarch-rv64gc_zba,gccarch-rv64gc_zbb,ccarch-rv64gc,gccarch-rv32gc_zba_zbb,gccarch-rv32gc_zba,gccarch-rv32gc_zbb,gccarch-rv32gc,big-parallel,native-riscv - + localhost armv7l-linux,powerpc-linux,powerpc64-linux,powerpc64le-linux,wasm32-wasi,x86_64-linux,i686-linux,riscv32-linux,riscv64-linux - 12 1 kvm,nixos-test,big-parallel,benchmark,gccarch-znver1,gccarch-skylake,ca-derivations - + build-aarch64 aarch64-linux,riscv32-linux,riscv64-linux - 4 1 nixos-test,benchmark,ca-derivations,gccarch-armv8-a,gccarch-armv8.1-a,gccarch-armv8.2-a,big-parallel - + build-riscv riscv64-linux,riscv32-linux - 4 2 nixos-test,benchmark,ca-derivations,gccarch-rv64gc_zba_zbb,gccarch-rv64gc_zba,gccarch-rv64gc_zbb,ccarch-rv64gc,gccarch-rv32gc_zba_zbb,gccarch-rv32gc_zba,gccarch-rv32gc_zbb,gccarch-rv32gc,big-parallel,native-riscv - ''; sshConfig = pkgs.writeText "ssh-config" '' Host build-aarch64 @@ -124,7 +124,7 @@ in { }; script = '' if ${pkgs.iputils}/bin/ping -c 1 nutty-noon.int.chir.rs; then - echo "build-pc armv7l-linux,powerpc-linux,powerpc64-linux,powerpc64le-linux,wasm32-wasi,x86_64-linux,i686-linux - 16 2 kvm,nixos-test,big-parallel,benchmark,gccarch-znver2,gccarch-znver1,gccarch-skylake,ca-derivations -" > /run/hydra-machines + echo "build-pc armv7l-linux,powerpc-linux,powerpc64-linux,powerpc64le-linux,wasm32-wasi,x86_64-linux,i686-linux,riscv32-linux,riscv64-linux - 16 1 kvm,nixos-test,big-parallel,benchmark,gccarch-znver2,gccarch-znver1,gccarch-skylake,ca-derivations -" > /run/hydra-machines else rm -f /run/hydra-machines fi