nixos-config/qemu-user.nix

30 lines
1.1 KiB
Nix
Raw Normal View History

2018-12-18 16:30:45 +00:00
{ 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 {
2019-05-28 15:05:23 +00:00
boot.binfmt.registrations = {
2018-12-18 16:30:45 +00:00
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}" ];
}