From 1acc701fdbcefba6ff1aea833001b6301ad8673e Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 17 Jul 2019 17:00:46 -0400 Subject: nixos/binfmt: handle wasm binaries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds handling for WASM binaries to binfmt’s emulatedSystems. To enable, add this to your configuration: boot.binfmt.emulatedSystems = [ "wasm32-wasi" ]; After rebuilding with nixos-rebuild switch, you can run wasm binaries directly. --- nixos/modules/system/boot/binfmt.nix | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'nixos/modules/system') diff --git a/nixos/modules/system/boot/binfmt.nix b/nixos/modules/system/boot/binfmt.nix index d6c0f0504868..eff258945776 100644 --- a/nixos/modules/system/boot/binfmt.nix +++ b/nixos/modules/system/boot/binfmt.nix @@ -115,6 +115,14 @@ let magicOrExtension = ''\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00''; mask = ''\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff''; }; + wasm32-wasi = { + magicOrExtension = ''\x00asm''; + mask = ''\xff\xff\xff\xff''; + }; + wasm64-wasi = { + magicOrExtension = ''\x00asm''; + mask = ''\xff\xff\xff\xff''; + }; x86_64-windows = { magicOrExtension = ".exe"; recognitionType = "extension"; -- cgit 1.4.1 From 857f7fb4af34d3417b8d1a0e901ba75f4cba39a0 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 17 Jul 2019 17:09:20 -0400 Subject: nixos/binfmt: update release notes and provide examples --- nixos/doc/manual/release-notes/rl-1909.xml | 9 +++++++++ nixos/modules/system/boot/binfmt.nix | 1 + 2 files changed, 10 insertions(+) (limited to 'nixos/modules/system') diff --git a/nixos/doc/manual/release-notes/rl-1909.xml b/nixos/doc/manual/release-notes/rl-1909.xml index 30570a279eca..dbbf46dfa832 100644 --- a/nixos/doc/manual/release-notes/rl-1909.xml +++ b/nixos/doc/manual/release-notes/rl-1909.xml @@ -33,6 +33,15 @@ PHP 7.1 is no longer supported due to upstream not supporting this version for the entire lifecycle of the 19.09 release. + + + The binfmt module is now easier to use. Additional systems can + be added through . + For instance, boot.binfmt.emulatedSystems = [ + "wasm32-wasi" "x86_64-windows" "aarch64-linux" ]; will + set up binfmt interpreters for each of those listed systems. + + diff --git a/nixos/modules/system/boot/binfmt.nix b/nixos/modules/system/boot/binfmt.nix index eff258945776..a550ffd6320f 100644 --- a/nixos/modules/system/boot/binfmt.nix +++ b/nixos/modules/system/boot/binfmt.nix @@ -234,6 +234,7 @@ in { emulatedSystems = mkOption { default = []; + example = [ "wasm32-wasi" "x86_64-windows" "aarch64-linux" ]; description = '' List of systems to emulate. Will also configure Nix to support your new systems. -- cgit 1.4.1