diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2020-12-31 13:28:01 -0600 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2020-12-31 13:28:01 -0600 |
commit | 08135a3caa45ed8d278099b60d64bdaf6987d5b9 (patch) | |
tree | 3fc4387446b9bc55452579073d9863a3285dd00d /nixos | |
parent | 2f47650c2f28d87f86ab807b8a339c684d91ec56 (diff) | |
download | nixpkgs-08135a3caa45ed8d278099b60d64bdaf6987d5b9.tar nixpkgs-08135a3caa45ed8d278099b60d64bdaf6987d5b9.tar.gz nixpkgs-08135a3caa45ed8d278099b60d64bdaf6987d5b9.tar.bz2 nixpkgs-08135a3caa45ed8d278099b60d64bdaf6987d5b9.tar.lz nixpkgs-08135a3caa45ed8d278099b60d64bdaf6987d5b9.tar.xz nixpkgs-08135a3caa45ed8d278099b60d64bdaf6987d5b9.tar.zst nixpkgs-08135a3caa45ed8d278099b60d64bdaf6987d5b9.zip |
nixos/binfmt.nix: fix running commands in binfmt
To allow arguments in binfmt, we need to put the command in a shell script. This uses exec to run the binfmt interpreter. Fixes #90683
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/system/boot/binfmt.nix | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/nixos/modules/system/boot/binfmt.nix b/nixos/modules/system/boot/binfmt.nix index 9eeae0c3ef4..5bcc95be324 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; |