Skip to content

Instantly share code, notes, and snippets.

@risicle
Last active June 16, 2024 11:51
Show Gist options
  • Save risicle/18c5d0aed51ad0c45dd4a015a00bec00 to your computer and use it in GitHub Desktop.
Save risicle/18c5d0aed51ad0c45dd4a015a00bec00 to your computer and use it in GitHub Desktop.
nixpkgs overlay for supplying extra flags to the qemu used in nixos' `boot.binfmt.emulatedSystems`. Note these specific flags used in this example are architecture-specific, but the flags are applied globally so this wouldn't work if emulating multiple architectures at once on the same system.
(final: prev: {
wrapQemuBinfmtP = name: emulator:
prev.wrapQemuBinfmtP name (
pkgs.runCommand "${name}-arg-wrapper" {
nativeBuildInputs = [ final.pkgsStatic.makeBinaryWrapper ];
} ''
makeWrapper ${emulator} $out --add-flags '-cpu max,pauth-impdef=on'
''
);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment