Last active
July 12, 2023 10:09
-
-
Save edef1c/619f262854829ceab306686a342fa4a4 to your computer and use it in GitHub Desktop.
NixOS module for qemu-user binfmt_misc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs, ... }: | |
let inherit (pkgs) stdenv qemu getopt; in | |
{ | |
systemd.additionalUpstreamSystemUnits = [ | |
"proc-sys-fs-binfmt_misc.automount" | |
"proc-sys-fs-binfmt_misc.mount" | |
]; | |
environment.etc."binfmt.d/qemu-user.conf".source = stdenv.mkDerivation { | |
name = "qemu-binfmt"; | |
inherit (qemu) src; | |
buildInputs = [ getopt ]; | |
configurePhase = '' | |
patchShebangs scripts/qemu-binfmt-conf.sh | |
''; | |
buildPhase = '' | |
mkdir binfmt | |
scripts/qemu-binfmt-conf.sh --qemu-path ${qemu}/bin --systemd ALL --exportdir=binfmt | |
''; | |
installPhase = '' | |
cat binfmt/*.conf > $out | |
''; | |
}; | |
nix = { | |
sandboxPaths = [ "${qemu}" ]; | |
extraOptions = '' | |
extra-platforms = i686-linux aarch64-linux armv5tel-linux armv6l-linux armv7l-linux mips64-linux mipsel-linux | |
''; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment