Created
June 1, 2017 08:52
-
-
Save puffnfresh/80192a09a59a849462ac3e2fa11eeb3e to your computer and use it in GitHub Desktop.
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
with import <nixpkgs> { }; | |
let | |
img = "bzImage"; | |
hyperkitCommand = '' | |
${hyperkit}/bin/hyperkit \ | |
-A \ | |
-m 512M \ | |
-s 0,hostbridge \ | |
-s 1,lpc \ | |
-s 2,virtio-rnd \ | |
-s 3,virtio-9p,path=${builtins.storeDir},tag=store \ | |
-s 4,virtio-9p,path=$TMPDIR/xchg,tag=xchg \ | |
-l com1,stdio \ | |
-U 8888badf-970e-4577-a6fa-6dd16c9d7798 \ | |
-f kexec,${(forceSystem "x86_64-linux" "x86_64").linux}/${img},${vmTools.initrd}/initrd,"earlyprintk=serial console=ttyS0 panic=1 command=${vmTools.stage2Init} out=$out mountDisk=$mountDisk loglevel=4" | |
''; | |
runInLinuxVM = drv: lib.overrideDerivation drv ({ memSize ? 512, QEMU_OPTS ? "", args, builder, ... }: { | |
builder = "${bash}/bin/sh"; | |
args = ["-e" (vmTools.vmRunCommand hyperkitCommand)]; | |
origArgs = args; | |
origBuilder = builder; | |
passAsFile = []; # HACK fix - see https://github.com/NixOS/nixpkgs/issues/16742 | |
}); | |
in | |
runInLinuxVM hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment