Last active
March 2, 2016 22:41
-
-
Save cleverca22/30fdeacb2287ae1c1802 to your computer and use it in GitHub Desktop.
qemu userland
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
{ | |
packageOverrides = pkgs: rec { | |
qemu-user-arm = pkgs.callPackage ./qemu-user.nix { user_arch = "arm"; }; | |
qemu-user-arm64 = pkgs.callPackage ./qemu-user.nix { user_arch = "aarch64"; }; | |
nix = pkgs.stdenv.lib.overrideDerivation pkgs.nix (oldAttrs: { | |
patches = ./hax.patch; | |
}); | |
}; | |
} |
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
diff -ru nix-1.11.1-orig/src/libstore/build.cc nix-1.11.1/src/libstore/build.cc | |
--- nix-1.11.1-orig/src/libstore/build.cc 2016-02-18 16:11:21.372535034 -0400 | |
+++ nix-1.11.1/src/libstore/build.cc 2016-02-18 16:11:44.866337212 -0400 | |
@@ -1259,16 +1259,7 @@ | |
static bool canBuildLocally(const BasicDerivation & drv) | |
{ | |
- return drv.platform == settings.thisSystem | |
- || isBuiltin(drv) | |
-#if __linux__ | |
- || (drv.platform == "i686-linux" && settings.thisSystem == "x86_64-linux") | |
- || (drv.platform == "armv6l-linux" && settings.thisSystem == "armv7l-linux") | |
-#elif __FreeBSD__ | |
- || (drv.platform == "i686-linux" && settings.thisSystem == "x86_64-freebsd") | |
- || (drv.platform == "i686-linux" && settings.thisSystem == "i686-freebsd") | |
-#endif | |
- ; | |
+ return true; | |
} | |
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
{ stdenv, fetchurl, python, pkgconfig, zlib, glib, user_arch, flex, bison, makeStaticLibraries }: | |
let | |
env2 = makeStaticLibraries stdenv; | |
myzlib = zlib.overrideDerivation (args: { | |
configureFlags = toString args.configureFlags or "" + " --static"; | |
}); | |
myglib = glib.override { stdenv = env2; }; | |
in | |
stdenv.mkDerivation rec { | |
name = "qemu-user-${user_arch}-${version}"; | |
version = "2.4.0"; | |
buildInputs = [ python pkgconfig myzlib myglib flex bison ]; | |
src = fetchurl { | |
url = "http://wiki.qemu.org/download/qemu-${version}.tar.bz2"; | |
sha256 = "0836gqv5zcl0xswwjcns3mlkn18lyz2fiq8rl1ihcm6cpf8vkc3j"; | |
}; | |
configureFlags = [ | |
"--enable-linux-user" "--target-list=${user_arch}-linux-user" | |
"--disable-bsd-user" "--disable-system" "--disable-vnc" "--without-pixman" | |
"--disable-vnc-tls" "--disable-curses" "--disable-sdl" "--disable-vde" | |
"--disable-bluez" "--disable-kvm" | |
"--static" | |
"--disable-tools" | |
]; | |
postInstall = '' | |
cat <<EOF > $out/bin/register | |
#!/bin/sh | |
modprobe binfmt_misc | |
mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc | |
echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:$out/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register | |
EOF | |
chmod +x $out/bin/register | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment