about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorarcnmx <arcnmx@users.noreply.github.com>2021-08-04 12:35:33 -0700
committerarcnmx <git@git.arcn.mx>2022-12-01 14:57:59 -0800
commit873074ac6024a36f828f6e44f0c004607e93cba7 (patch)
treebfcbb7c9c078ad37b1411d79ecfa67441e511f11 /nixos/modules/system
parent2abf40d9b5bfaa49898af7b18b69a86247c29f2c (diff)
nixos/binfmt: add interpreter path to sandbox
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/binfmt.nix8
1 files changed, 4 insertions, 4 deletions
diff --git a/nixos/modules/system/boot/binfmt.nix b/nixos/modules/system/boot/binfmt.nix
index 87e66f73be0ec..e8d63445b44f3 100644
--- a/nixos/modules/system/boot/binfmt.nix
+++ b/nixos/modules/system/boot/binfmt.nix
@@ -281,7 +281,7 @@ in {
   config = {
     boot.binfmt.registrations = builtins.listToAttrs (map (system: {
       name = system;
-      value = let
+      value = { config, ... }: let
         interpreter = getEmulator system;
         qemuArch = getQemuArch system;
 
@@ -292,13 +292,13 @@ in {
         in
           if preserveArgvZero then "${wrapper}/bin/${wrapperName}"
           else interpreter;
-      in {
+      in ({
         inherit preserveArgvZero;
 
         interpreter = interpreterReg;
         wrapInterpreterInShell = !preserveArgvZero;
-        interpreterSandboxPath = dirOf (dirOf interpreterReg);
-      } // (magics.${system} or (throw "Cannot create binfmt registration for system ${system}"));
+        interpreterSandboxPath = dirOf (dirOf config.interpreter);
+      } // (magics.${system} or (throw "Cannot create binfmt registration for system ${system}")));
     }) cfg.emulatedSystems);
     nix.settings = lib.mkIf (cfg.emulatedSystems != []) {
       extra-platforms = cfg.emulatedSystems ++ lib.optional pkgs.stdenv.hostPlatform.isx86_64 "i686-linux";