30 lines
1.1 KiB
Nix
30 lines
1.1 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
arm = {
|
|
interpreter = "${pkgs.qemu}/bin/qemu-arm";
|
|
magicOrExtension = ''\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00'';
|
|
mask = ''\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff'';
|
|
};
|
|
aarch64 = {
|
|
interpreter = "${pkgs.qemu}/bin/qemu-aarch64";
|
|
magicOrExtension = ''\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00'';
|
|
mask = ''\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff'';
|
|
};
|
|
riscv64 = {
|
|
interpreter = "${pkgs.qemu}/bin/qemu-riscv64";
|
|
magicOrExtension = ''\x7fELF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf3\x00'';
|
|
mask = ''\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff'';
|
|
};
|
|
in {
|
|
boot.binfmt.registrations = {
|
|
inherit arm;
|
|
inherit aarch64;
|
|
inherit riscv64;
|
|
};
|
|
nix.extraOptions = ''
|
|
extra-platforms = armv6l-linux armv7l-linux aarch64-linux riscv64-linux i686-linux
|
|
'';
|
|
nix.sandboxPaths = [ "/run/binfmt" "${pkgs.qemu}" ];
|
|
}
|