-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdefault.nix
58 lines (50 loc) · 1.37 KB
/
default.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ hypervisor ? import ../../nix/hypervisor {} }:
let
inherit (hypervisor.framework) lib pkgs;
in
lib.flip lib.mapAttrs pkgs.none.icecap.configured (_: configured:
let
inherit (pkgs) dev;
inherit (pkgs.none.icecap) platUtils;
inherit (configured) icecapFirmware icecapPlat selectIceCapPlatOr mkLinuxRealm;
in rec {
realms = {
vm = import ./realms/vm { inherit lib pkgs; };
mirage =
if dev.hostPlatform.isx86_64
then import ./realms/mirage { inherit lib pkgs; }
else {
spec = dev.emptyFile;
};
};
run = platUtils.${icecapPlat}.bundle {
inherit (icecapFirmware) image;
payload = icecapFirmware.mkDefaultPayload {
kernel = pkgs.linux.icecap.linuxKernel.host.${icecapPlat}.kernel;
initramfs = hostUser.config.build.initramfs;
bootargs = [
"earlycon=icecap_vmm"
"console=hvc0"
"loglevel=7"
"vm-realm-spec=${realms.vm.spec}"
"mirage-realm-spec=${realms.mirage.spec}"
];
};
platArgs = selectIceCapPlatOr {} {
rpi4 = {
extraBootPartitionCommands = ''
ln -s ${realms.vm.spec} $out/vm-realm-spec.bin
ln -s ${realms.mirage.spec} $out/mirage-realm-spec.bin
'';
};
};
};
hostUser = pkgs.linux.icecap.nixosLite.eval {
modules = [
./config.nix
{
instance.plat = icecapPlat;
}
];
};
})