binfmt.nix (837B)
1 { config, lib, pkgs, ... }: 2 3 let 4 inherit (lib) mkEnableOption mkIf types; 5 cfg = config.modules.core.binfmt; 6 in 7 { 8 options = { 9 modules.core.binfmt = { 10 enable = mkEnableOption "Register extra emulated systems using binfmt"; 11 }; 12 }; 13 config = mkIf cfg.enable { 14 boot = { 15 binfmt.registrations = { 16 s390x-linux = { 17 # interpreter = getEmulator "s390x-linux"; 18 interpreter = "${pkgs.qemu}/bin/qemu-s390x"; 19 magicOrExtension = ''\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16''; 20 mask = ''\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff''; 21 }; 22 }; 23 binfmt.emulatedSystems = [ 24 "armv6l-linux" 25 "armv7l-linux" 26 "aarch64-linux" 27 "powerpc64le-linux" 28 ]; 29 }; 30 }; 31 }