-
-
Save sorki/548de08f621b066c94f0c36a7a78cc41 to your computer and use it in GitHub Desktop.
{ config, lib, pkgs, ... }: | |
{ | |
imports = [ | |
<nixpkgs/nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix> | |
]; | |
nixpkgs = { | |
crossSystem.system = "armv7l-linux"; | |
}; | |
# closure minification | |
environment.noXlibs = true; | |
services.xserver.enable = false; | |
services.xserver.desktopManager.xterm.enable = lib.mkForce false; | |
# this pulls too much graphical stuff | |
services.udisks2.enable = lib.mkForce false; | |
# this pulls spidermonkey and firefox | |
security.polkit.enable = false; | |
boot.supportedFilesystems = lib.mkForce [ "vfat" ]; | |
i18n.supportedLocales = lib.mkForce [ (config.i18n.defaultLocale + "/UTF-8") ]; | |
documentation.enable = false; | |
documentation.nixos.enable = false; | |
} |
export NIX_PATH=nixpkgs=/home/jane/local_nixpkgs_checkout | |
nix-build --cores 0 '<nixpkgs/nixos>' \ | |
-I nixos-config=configuration.nix \ | |
-A config.system.build.sdImage \ | |
-o result-cross \ | |
--keep-going |
This minimal image takes reasonable amount of time to build on 8 core machine (like ~4 hours from scratch). You already get some things from official cache.nixos.org
thanks to nixos-mobile
using the cross tooling. How much is cached also depends on nixpkgs commit you pick.
The ones listed on the wiki are only useful for native / QEMU builds since with cross compilation you end up with different Nix store paths. That means you currently cannot interchange native and cross built packages - you might need to install the ones listed on the wiki iff you want to nixos-rebuild
cross-built image on the target (I usually don't build anything on rPIs, just push cross-built closures from x86 or another bit more powerful armv7 builder).
Interesting. IIRC that Aarch64 can't be used for my specific RPI hardware. It'd be nice if hydra could help us with the cross builds - see mobile-nixos/mobile-nixos#197
@sorki this looks great! I haven't yet completed the build as it seems like it's gonna take forever. Are there any binary caches available? I added to my x86_64 machine those listed at the wiki but it didn't help to reduce the amount of builds. I tried using my own
configuration.nix
based on yours and I noticed that it will attempt to build gcc and firefox..