summaryrefslogtreecommitdiffstats
path: root/nixos/modules/system/boot/binfmt.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/system/boot/binfmt.nix')
-rw-r--r--nixos/modules/system/boot/binfmt.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/nixos/modules/system/boot/binfmt.nix b/nixos/modules/system/boot/binfmt.nix
index 9eeae0c3ef44..5bcc95be324a 100644
--- a/nixos/modules/system/boot/binfmt.nix
+++ b/nixos/modules/system/boot/binfmt.nix
@@ -20,8 +20,14 @@ let
optionalString fixBinary "F";
in ":${name}:${type}:${offset'}:${magicOrExtension}:${mask'}:${interpreter}:${flags}";
- activationSnippet = name: { interpreter, ... }:
- "ln -sf ${interpreter} /run/binfmt/${name}";
+ activationSnippet = name: { interpreter, ... }: ''
+ rm -f /run/binfmt/${name}
+ cat > /run/binfmt/${name} << 'EOF'
+ #!/usr/bin/env sh
+ exec -- ${interpreter} "$@"
+ EOF
+ chmod +x /run/binfmt/${name}
+ '';
getEmulator = system: (lib.systems.elaborate { inherit system; }).emulator pkgs;