git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #108072 from matthewbauer/fix-binfmt-activation

nixos/binfmt.nix: fix running commands in binfmt

commitda9fc7b068face89d8b77a08eef99694a7dc07f9 authorMatthew Bauer <mjbauer95@gmail.com> dateWed 20 Jan 2021, 16:31 (6 years ago) parentc4965b408135a3
1 file changed+8−2
nixos/modules/system/boot/binfmt.nix+8−2
nixos/modules/system/boot/binfmt.nix+8−2
@@ -20,8 +20,14 @@ let
2020 optionalString fixBinary "F";
2121 in ":${name}:${type}:${offset'}:${magicOrExtension}:${mask'}:${interpreter}:${flags}";
2222
23− activationSnippet = name: { interpreter, ... }:
24− "ln -sf ${interpreter} /run/binfmt/${name}";
23+ activationSnippet = name: { interpreter, ... }: ''
24+ rm -f /run/binfmt/${name}
25+ cat > /run/binfmt/${name} << 'EOF'
26+ #!/usr/bin/env sh
27+ exec -- ${interpreter} "$@"
28+ EOF
29+ chmod +x /run/binfmt/${name}
30+ '';
2531
2632 getEmulator = system: (lib.systems.elaborate { inherit system; }).emulator pkgs;
2733