| 30 Jun 2022 |
matthewcroughan - nix.how | And it's set up to do remote builds on my beefy ryzen 5950x box, so everything just sorta happens, and fast. | 09:22:40 |
matthewcroughan - nix.how | Is it possible to do remote builds with cross-compilation? | 09:23:07 |
matthewcroughan - nix.how | * Is it possible to do remote/distributed builds with cross-compilation? | 09:23:18 |
Alyssa Ross | should be | 09:23:24 |
dramforever | i think it works eactly the same because nix doesn't know about cross anyway | 09:24:45 |
dramforever | wait do you mean (build, host, target) kind of cross or qemu-user kind of cross | 09:25:08 |
matthewcroughan - nix.how | I mean like I'm doing in my visionfive-nix flake | 09:25:29 |
matthewcroughan - nix.how | {
nix.buildMachines = [ {
hostName = "builder";
system = "x86_64-linux";
# if the builder supports building for multiple architectures,
# replace the previous line by, e.g.,
# systems = ["x86_64-linux" "aarch64-linux"];
maxJobs = 1;
speedFactor = 2;
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
mandatoryFeatures = [ ];
}] ;
nix.distributedBuilds = true;
# optional, useful when the builder has a faster internet connection than yours
nix.extraOptions = ''
builders-use-substitutes = true
'';
}
| 09:25:31 |
matthewcroughan - nix.how | here's the example from https://nixos.wiki/wiki/Distributed_build | 09:25:41 |
matthewcroughan - nix.how | in this case, system = "x86_64-linux"; I want to be able to put a config on my visionfive, that says "Do a distributed build, where you cross-compile for riscv64 on an x86_64-linux machine" | 09:26:18 |
matthewcroughan - nix.how | this would work with binfmt, but I actually just want cross-compilatin | 09:26:36 |
dramforever | nix only sees 'on a x86_64-linux machine' | 09:26:37 |
matthewcroughan - nix.how | * this would work with binfmt, but I actually just want cross-compilation | 09:26:38 |
dramforever | so it works like any other x86_64-linux build | 09:26:46 |
matthewcroughan - nix.how | ah right it's my nixos config that needs to be set `crossSystem = "riscv64-linux"; | 09:27:17 |
matthewcroughan - nix.how | * ah right it's my nixos config that needs to be set `crossSystem = "riscv64-linux"`; | 09:27:20 |
matthewcroughan - nix.how | * ah right it's my nixos config that needs to be set crossSystem = "riscv64-linux"\ | 09:27:23 |
matthewcroughan - nix.how | * ah right it's my nixos config that needs to be set `crossSystem = "riscv64-linux"\ | 09:27:25 |
matthewcroughan - nix.how | * ah right it's my nixos config that needs to be set nixpkgs.crossSystem = "riscv64-linux" | 09:27:30 |
matthewcroughan - nix.how | if I have a nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ { nixpkgs.crossSystem = "riscv64-linux"; } ]; } this will surprisingly just work | 09:28:28 |
matthewcroughan - nix.how | If I did nixos-rebuild switch --flake .#visionfive-cross-x86 -j0 on the board though.. I wonder if it would fail | 09:29:27 |
matthewcroughan - nix.how | the important part is that the board would have to perform 0 jobs, since its host architecture is riscv64-linux, and I'm just not sure if it'd work. I'd have to test. | 09:30:08 |
matthewcroughan - nix.how | * the important part is that the board would have to perform 0 jobs, since its host architecture is riscv64-linux and could not perform the work, and I'm just not sure if it'd work. I'd have to test. | 09:30:17 |
dramforever | yeah it complains about not being able to find a builder up to the task | 09:33:49 |
matthewcroughan - nix.how | it's a shame that a configuration can't mix and match cross-compiled and natively compiled paths | 09:34:50 |
matthewcroughan - nix.how | maybe that breaks everything in a way I can't see though | 09:35:03 |
dramforever | BTW In case this is helpful, https://hydra.nichi.co builds github:NickCao/nixpkgs/riscv and serves it at https://cache.nichi.co | 09:35:37 |
dramforever | In reply to @matthewcroughan:defenestrate.it it's a shame that a configuration can't mix and match cross-compiled and natively compiled paths you can, you just painstakingly set services.foo.package = whateverCrossPkgs everywhere and patch every NixOS module that says pkgs.bar | 09:36:28 |
dramforever | In reply to @matthewcroughan:defenestrate.it it's a shame that a configuration can't mix and match cross-compiled and natively compiled paths * you can, you just painstakingly set services.foo.package = whateverCrossPkgs.foo everywhere and patch every NixOS module that says pkgs.bar | 09:36:43 |
dramforever | In reply to @dramforever:matrix.org BTW In case this is helpful, https://hydra.nichi.co builds github:NickCao/nixpkgs/riscv and serves it at https://cache.nichi.co It's all x86_64-linux to riscv64-linux cross. I can't believe it even works. I think I just suggested NickCao do cross compilation once and look what they've done | 09:37:53 |