about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-07-17 17:00:46 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2019-07-17 17:00:46 -0400
commit1acc701fdbcefba6ff1aea833001b6301ad8673e (patch)
treea237db39b1626110d8883d4151e0b285958182fb /nixos/modules/system
parent31c38894c90429c9554eab1b416e59e3b6e054df (diff)
downloadnixlib-1acc701fdbcefba6ff1aea833001b6301ad8673e.tar
nixlib-1acc701fdbcefba6ff1aea833001b6301ad8673e.tar.gz
nixlib-1acc701fdbcefba6ff1aea833001b6301ad8673e.tar.bz2
nixlib-1acc701fdbcefba6ff1aea833001b6301ad8673e.tar.lz
nixlib-1acc701fdbcefba6ff1aea833001b6301ad8673e.tar.xz
nixlib-1acc701fdbcefba6ff1aea833001b6301ad8673e.tar.zst
nixlib-1acc701fdbcefba6ff1aea833001b6301ad8673e.zip
nixos/binfmt: handle wasm binaries
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.
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/binfmt.nix8
1 files changed, 8 insertions, 0 deletions
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";