I decided to reactivate my old raspberrypi 2 (armv7), the way i did with my raspi 4s (aarch64) before and to my surprise the usual nix build .#...sdImage failed with:
error: Cannot build '/nix/store/2h1bf9z321kib4wc46g0zhgnjhkh35hb-bootstrap-tools.drv'.
Reason: required system or feature not available
Required system: 'armv7l-linux' with features {}
Current system: 'x86_64-linux' with features {benchmark, big-parallel, flakes, kvm, nix-command, nixos-test}
[ ... many more successive deps failing ]
My nixos host is:
$ nix-info
system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.33.3, channels(root): "nixos", nixpkgs: /nix/store/zkrz054gvl1dcxkw25d8lgx8l10px665-source
With binfmt enabled for both foreign platforms
$ head /proc/sys/fs/binfmt_misc/*
==> /proc/sys/fs/binfmt_misc/aarch64-linux <==
enabled
interpreter /run/binfmt/aarch64-linux
flags: P
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00ffffffffffff00fffeffffff
==> /proc/sys/fs/binfmt_misc/armv7l-linux <==
enabled
interpreter /run/binfmt/armv7l-linux
flags: P
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff00ffffffffffff00fffeffffff
==> /proc/sys/fs/binfmt_misc/status <==
enabled
For tinkering, I have created a minimal flake to reproduce the issue:
{
inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
mkNixos =
platform: image:
nixpkgs.lib.nixosSystem {
modules = [
(
{ modulesPath, ... }:
{
imports = [ "${modulesPath}/installer/sd-card/${image}" ];
nixpkgs = {
hostPlatform = platform;
config.allowBroken = true; # pkgs.efivar is marked broken for armv7l
config.allowUnsupportedSystem = true; # pkgs.uboot-rpi_0_w_defconfig-2025.10 not supported for armv7l
};
}
)
];
};
in
{
nixosConfigurations = {
host_1 = mkNixos "aarch64-linux" "sd-image-aarch64-new-kernel.nix";
host_2 = mkNixos "armv7l-linux" "sd-image-armv7l-multiplatform.nix";
host_3 = mkNixos "armv7l-linux" "sd-image-raspberrypi.nix";
};
devShells.${system}.default = pkgs.mkShell {
shellHook =
let
buildAlias =
n: "alias build_${n}='nix build .#nixosConfigurations.host_${n}.config.system.build.sdImage'";
in
''
set -x
${buildAlias "1"}
${buildAlias "2"}
${buildAlias "3"}
set +x
'';
};
};
}
Building host_1 works as expected, host_2 and host_3 yield the error above. The same behavior occurs with nixpkgs?ref=nixos-25.11.
I don’t know how to proceed from here. Maybe (a) the armv7l nixosConfiguration is broken in an exotic way, or (b) the nix build command doesn’t work as told to, or (c) my local boot.binfmt.emulatedSystems is somehow incorrect but only for armv7l-linux.
I can’t even find the build logs or turn on verbosity for leads to why bootstrap-tools is getting build with my host arch and not target arch.