@@ -110,7 +110,7 @@ index 39dad9268bcb..45a7bc147d3e 100644
110110
111111 static AutoCloseFD fdSavedMountNamespace;
112112
113- From ebe69cf8f257da3001c982bb40efdb1b0e057f67 Mon Sep 17 00:00:00 2001
113+ From ad19f4ea37ccbf538802a826cb019847d31fa4bd Mon Sep 17 00:00:00 2001
114114From: dramforever <dramforever@live.com>
115115Date: Sun, 22 Mar 2026 22:02:20 +0800
116116Subject: [PATCH 2/3] libstore: Add and implement the binfmt-misc setting
@@ -132,7 +132,7 @@ case.
132132 3 files changed, 236 insertions(+), 3 deletions(-)
133133
134134diff --git a/src/libstore/include/nix/store/local-settings.hh b/src/libstore/include/nix/store/local-settings.hh
135- index a320c52293c1..fa55e9339563 100644
135+ index a320c52293c1..de186b8f741b 100644
136136--- a/src/libstore/include/nix/store/local-settings.hh
137137+++ b/src/libstore/include/nix/store/local-settings.hh
138138@@ -713,6 +713,60 @@ public:
@@ -151,19 +151,19 @@ index a320c52293c1..fa55e9339563 100644
151151+ `platform` is the name of the platform this item applies to, and
152152+ `registration,...` is a comma-separated list of zero or more
153153+ registration strings, each in the format that `/proc/sys/fs/binfmt_misc/register`
154- + accepts. See [Linux documentation on binfmt_misc ] for details.
154+ + accepts. See [Linux documentation on binfmt\_misc ] for details.
155155+ Whitespace and commas in the registration strings are not supported.
156156+
157- + [Linux documentation on binfmt_misc ]: https://docs.kernel.org/admin-guide/binfmt-misc.html
157+ + [Linux documentation on binfmt\_misc ]: https://docs.kernel.org/admin-guide/binfmt-misc.html
158158+
159159+ When building a derivation, if the platform of this derivation is
160160+ configured in the `binfmt-misc` setting, then the build runs with
161- + binfmt_misc configured with and only with the interpreters from the
161+ + binfmt\_misc configured with and only with the interpreters from the
162162+ corresponding list of registrations. Specifically, if the list is
163- + empty, then the build runs with no binfmt_misc interpreters.
163+ + empty, then the build runs with no binfmt\_misc interpreters.
164164+
165165+ This allows Nix to build derivations that are otherwise meant for
166- + foreign platforms using emulators. On systems with binfmt_misc
166+ + foreign platforms using emulators. On systems with binfmt\_misc
167167+ interpreters configured globally, this also allows Nix to opt out of
168168+ them while building derivations of the native platform, which improves
169169+ purity of cross compilation. Note that in order for Nix to accept
@@ -178,7 +178,7 @@ index a320c52293c1..fa55e9339563 100644
178178+ derivation's platform is configured in this setting, the build fails.
179179+ See also the [`sandbox`](#conf-sandbox) setting.
180180+
181- + The binfmt_misc interpreters are set up in such a way that if the `F`
181+ + The binfmt\_misc interpreters are set up in such a way that if the `F`
182182+ flag is used, then the interpreter path is taken as the path outside
183183+ the build sandbox; otherwise, the path is resolved as executables are
184184+ run, inside the build sandbox. It is recommended that the interpreter
0 commit comments