-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.nix
37 lines (32 loc) · 1.4 KB
/
release.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
let
pkgs = import <nixpkgs> { config = {}; };
callPackage = pkgs.newScope self;
self = {
kexec_tarball = (import <nixpkgs/nixos> {
configuration = ./configuration.nix;
}).config.system.build.kexec_tarball;
kexec_bundle = (import <nixpkgs/nixos> {
configuration = ./configuration.nix;
}).config.system.build.kexec_bundle;
qemu_test1 = let
config = (import <nixpkgs/nixos> { configuration = ./configuration.nix; }).config;
image = config.system.build.image;
in pkgs.writeScriptBin "qemu_test1" ''
#!${pkgs.stdenv.shell}
export PATH=${pkgs.qemu_kvm}/bin/:$PATH
if ! test -e dummy_root.qcow2; then
qemu-img create -f qcow2 dummy_root.qcow2 20G
fi
qemu-kvm -kernel ${image}/kernel -initrd ${image}/initrd -m 2048 -append "init=${builtins.unsafeDiscardStringContext config.system.build.toplevel}/init ${toString config.boot.kernelParams}" -monitor stdio -drive index=0,id=drive1,file=dummy_root.qcow2,cache=writeback,werror=report,if=virtio
'';
qemu_test2 = pkgs.writeScriptBin "qemu_test2" ''
#!${pkgs.stdenv.shell}
export PATH=${pkgs.qemu_kvm}/bin/:$PATH
qemu-kvm -monitor stdio -drive index=0,id=drive1,file=dummy_root.qcow2,cache=writeback,werror=report,if=virtio
'';
qemu_test = pkgs.buildEnv {
name = "qemu_test";
paths = with self; [ qemu_test1 qemu_test2 ];
};
};
in self