summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2021-01-20 16:31:53 -0600
committerGitHub <noreply@github.com>2021-01-20 16:31:53 -0600
commitda9fc7b068face89d8b77a08eef99694a7dc07f9 (patch)
treeb773933867293894f816dc5229de1efae3bde0ef /nixos/modules
parentc4965b409a80e8b0a552d114b983c9fbee4ea55e (diff)
parent08135a3caa45ed8d278099b60d64bdaf6987d5b9 (diff)
Merge pull request #108072 from matthewbauer/fix-binfmt-activation
nixos/binfmt.nix: fix running commands in binfmt
Diffstat (limited to 'nixos/modules')
-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;