about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-08-09 14:04:21 -0400
committerGitHub <noreply@github.com>2019-08-09 14:04:21 -0400
commitddf38a8241089d79c3bcd1777781b6438ab88d84 (patch)
tree7f7da4160b4679ef095112d688850ddf21fd5a2b
parentededb063329ce525f05e51c4dcdd8cfbe4adeb27 (diff)
parent857f7fb4af34d3417b8d1a0e901ba75f4cba39a0 (diff)
downloadnixlib-ddf38a8241089d79c3bcd1777781b6438ab88d84.tar
nixlib-ddf38a8241089d79c3bcd1777781b6438ab88d84.tar.gz
nixlib-ddf38a8241089d79c3bcd1777781b6438ab88d84.tar.bz2
nixlib-ddf38a8241089d79c3bcd1777781b6438ab88d84.tar.lz
nixlib-ddf38a8241089d79c3bcd1777781b6438ab88d84.tar.xz
nixlib-ddf38a8241089d79c3bcd1777781b6438ab88d84.tar.zst
nixlib-ddf38a8241089d79c3bcd1777781b6438ab88d84.zip
Merge pull request #65002 from matthewbauer/binfmt-wasm
Add binfmt interpreter for wasm
-rw-r--r--nixos/doc/manual/release-notes/rl-1909.xml9
-rw-r--r--nixos/modules/system/boot/binfmt.nix9
2 files changed, 18 insertions, 0 deletions
diff --git a/nixos/doc/manual/release-notes/rl-1909.xml b/nixos/doc/manual/release-notes/rl-1909.xml
index 8e432932d29a..37e9c2dbbb63 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.
     </para>
    </listitem>
+   <listitem>
+     <para>
+       The binfmt module is now easier to use. Additional systems can
+       be added through <option>boot.binfmt.emulatedSystems</option>.
+       For instance, <literal>boot.binfmt.emulatedSystems = [
+       "wasm32-wasi" "x86_64-windows" "aarch64-linux" ];</literal> will
+       set up binfmt interpreters for each of those listed systems.
+     </para>
+   </listitem>
   </itemizedlist>
  </section>
 
diff --git a/nixos/modules/system/boot/binfmt.nix b/nixos/modules/system/boot/binfmt.nix
index d6c0f0504868..a550ffd6320f 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";
@@ -226,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.