2020-11-01 20:21:27 +01:00
|
|
|
{ config, pkgs, lib, modulesPath, ... }:
|
|
|
|
|
|
|
|
with lib;
|
2020-12-03 12:48:07 +01:00
|
|
|
let
|
|
|
|
localPackages = pkgs.buildPackages;
|
2021-02-16 15:25:30 +01:00
|
|
|
binary = mkOption {
|
2021-02-16 12:10:50 +01:00
|
|
|
description = "Program binary for this child. Must be an ERIS URN";
|
|
|
|
default = null;
|
|
|
|
type = types.nullOr
|
|
|
|
(types.str // { check = lib.strings.hasPrefix "urn:erisx2:"; });
|
|
|
|
example =
|
|
|
|
"urn:erisx2:AEAU4KT7AGJLA5BHPWFZ7HX2OVVNVFGDM2SIS726OPZBGXDED64QIDPHN2M5P5HIMOG3YDSWBGDPNUMZKCG4CRVU4DI5BOS5IJRFCSLQQY";
|
|
|
|
};
|
|
|
|
package = mkOption {
|
|
|
|
description = "Package to source the binary for this child.";
|
|
|
|
type = lib.types.package;
|
|
|
|
example = literalExample "pkg.genodePackages.init";
|
2021-02-16 15:25:30 +01:00
|
|
|
};
|
2020-12-03 12:48:07 +01:00
|
|
|
coreROMs = mkOption {
|
|
|
|
type = with types; listOf str;
|
|
|
|
default = [ ];
|
|
|
|
description = ''
|
|
|
|
List of label suffixes that when matched against
|
|
|
|
ROM requests shall be forwared to the core.
|
|
|
|
'';
|
|
|
|
example = [ "platform_info" ];
|
|
|
|
};
|
2021-02-16 15:25:30 +01:00
|
|
|
extraInputs = mkOption {
|
2020-12-03 12:48:07 +01:00
|
|
|
description = "List of packages to build a ROM store with.";
|
|
|
|
default = [ ];
|
|
|
|
type = types.listOf types.package;
|
|
|
|
};
|
2021-02-16 12:10:50 +01:00
|
|
|
|
|
|
|
children' = with builtins;
|
|
|
|
lib.attrsets.mapAttrs (childName: child:
|
|
|
|
if child.binary != null then {
|
|
|
|
inherit (child) binary configFile;
|
|
|
|
roms = { };
|
|
|
|
} else
|
|
|
|
let bin = lib.getEris "bin" child.package;
|
|
|
|
in {
|
|
|
|
config = ''${child.configFile} "${bin.cap}"'';
|
|
|
|
binary = bin.cap;
|
|
|
|
roms = [{
|
|
|
|
name = bin.cap;
|
|
|
|
value = bin.path;
|
|
|
|
}] ++ lib.mapAttrsToList (path: cap: {
|
|
|
|
name = cap;
|
|
|
|
value = path;
|
|
|
|
}) bin.closure;
|
|
|
|
}) config.genode.core.children;
|
|
|
|
|
|
|
|
coreErisCaps = with builtins;
|
|
|
|
let pkgNames = [ "cached_fs_rom" "jitter_sponge" "rtc_drv" ];
|
|
|
|
in listToAttrs (map (name:
|
|
|
|
let pkg = pkgs.genodePackages.${name};
|
|
|
|
in {
|
|
|
|
inherit name;
|
|
|
|
value = lib.getEris "bin" pkg;
|
|
|
|
}) pkgNames);
|
|
|
|
|
|
|
|
tarball =
|
|
|
|
"${config.system.build.tarball}/tarball/${config.system.build.tarball.fileName}.tar";
|
|
|
|
|
|
|
|
/* romDirectories = filterAttrs (_: value: value != null) (mapAttrs (name: value:
|
|
|
|
if value.extraInputs == [ ] then
|
|
|
|
null
|
|
|
|
else
|
|
|
|
pkgs.symlinkJoin {
|
|
|
|
name = "${name}-rom";
|
|
|
|
paths = value.extraInputs;
|
|
|
|
}) config.genode.init.children);
|
|
|
|
*/
|
|
|
|
|
|
|
|
bootConfigFile = let
|
|
|
|
|
|
|
|
storeBackendInputs = {
|
|
|
|
fs = [ pkgs.genodePackages.rump ];
|
|
|
|
memory = [ config.system.build.tarball ];
|
|
|
|
}.${config.genode.boot.storeBackend};
|
|
|
|
|
|
|
|
coreInputs = with builtins;
|
|
|
|
concatMap (getAttr "extraInputs")
|
|
|
|
(attrValues config.genode.core.children);
|
|
|
|
|
|
|
|
mergeManifests = inputs:
|
|
|
|
with builtins;
|
|
|
|
let
|
|
|
|
f = head: input:
|
|
|
|
if hasAttr "manifest" input then
|
|
|
|
''
|
|
|
|
${head}, { mapKey = "${
|
|
|
|
lib.getName input
|
|
|
|
}", mapValue = ${input.manifest} }''
|
|
|
|
else
|
|
|
|
abort "${input.pname} does not have a manifest";
|
|
|
|
in (foldl' f "[" inputs) + "]";
|
|
|
|
|
|
|
|
addManifest = drv:
|
|
|
|
drv // {
|
|
|
|
manifest =
|
|
|
|
localPackages.runCommand "${drv.name}.dhall" { inherit drv; } ''
|
|
|
|
set -eu
|
|
|
|
echo -n '[' >> $out
|
|
|
|
find $drv/ -type f -printf ',{mapKey= "%p",mapValue="%p"}' >> $out
|
|
|
|
${if builtins.elem "lib" drv.outputs then
|
|
|
|
''
|
|
|
|
find ${drv.lib}/ -type f -printf ',{mapKey= "%p",mapValue="%p"}' >> $out''
|
|
|
|
else
|
|
|
|
""}
|
|
|
|
echo -n ']' >> $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
manifest =
|
|
|
|
# Manifests are Dhall metadata to be attached to every
|
|
|
|
# package to be used for dynamically buildings enviroments
|
|
|
|
# using Dhall expressions. Probably not worth pursuing.
|
|
|
|
pkgs.writeText "manifest.dhall" (mergeManifests (map addManifest
|
|
|
|
(with pkgs.genodePackages; storeBackendInputs ++ coreInputs))
|
|
|
|
+ lib.optionalString (config.genode.boot.romModules != { }) ''
|
|
|
|
# [ { mapKey = "romModules", mapValue = [ ${
|
|
|
|
lib.concatStringsSep ", " (lib.lists.flatten ((mapAttrsToList
|
|
|
|
(k: v: ''{ mapKey = "${k}", mapValue = "${v}" }'')
|
|
|
|
config.genode.boot.romModules)))
|
|
|
|
}] } ]'');
|
|
|
|
|
|
|
|
/* storeRomPolicies = mapAttrsToList
|
|
|
|
(name: value: '', { mapKey = "${name}", mapValue = "${value}" }'')
|
|
|
|
romDirectories;
|
|
|
|
*/
|
|
|
|
|
|
|
|
extraRoutes = lib.concatStringsSep ", " (lib.lists.flatten
|
|
|
|
(lib.mapAttrsToList (name: value:
|
|
|
|
map (suffix: ''
|
|
|
|
{ service =
|
|
|
|
{ name = "ROM"
|
|
|
|
, label =
|
|
|
|
Genode.Init.LabelSelector.Type.Partial
|
|
|
|
{ prefix = Some "nixos -> ${name}", suffix = Some "${suffix}" }
|
|
|
|
}
|
|
|
|
, route = Genode.Init.Route.parent (Some "${suffix}")
|
|
|
|
}
|
|
|
|
'') value.coreROMs) config.genode.init.children));
|
|
|
|
|
|
|
|
extraCoreChildren = "[ ${
|
|
|
|
lib.concatStringsSep ", " (lib.mapAttrsToList
|
|
|
|
(name: value: ''{ mapKey = "${name}", mapValue = ${value.config} }'')
|
|
|
|
children')
|
|
|
|
} ]";
|
|
|
|
|
|
|
|
in with coreErisCaps;
|
|
|
|
localPackages.runCommand "boot.dhall" { } ''
|
|
|
|
cat > $out << EOF
|
|
|
|
let Genode = env:DHALL_GENODE in
|
|
|
|
let VFS = Genode.VFS
|
|
|
|
let XML = Genode.Prelude.XML
|
|
|
|
in
|
|
|
|
${./store-wrapper.dhall}
|
|
|
|
{ binaries = {
|
|
|
|
, cached_fs_rom = "${cached_fs_rom.cap}"
|
|
|
|
, jitter_sponge = "${jitter_sponge.cap}"
|
|
|
|
, rtc_drv = "${rtc_drv.cap}"
|
|
|
|
}
|
|
|
|
, extraCoreChildren = ${extraCoreChildren}
|
|
|
|
, subinit = ${config.genode.init.configFile}
|
|
|
|
, storeSize = $(stat --format '%s' ${tarball})
|
|
|
|
, routes = [${extraRoutes} ] : List Genode.Init.ServiceRoute.Type
|
|
|
|
, bootManifest = ${manifest}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
|
|
|
erisContents = lib.attrsets.mapAttrsToList (urn: source: {
|
|
|
|
target = "eris/" + urn;
|
|
|
|
inherit source;
|
|
|
|
}) config.genode.init.romModules;
|
|
|
|
|
2020-11-01 20:21:27 +01:00
|
|
|
in {
|
|
|
|
options.genode = {
|
2020-12-03 12:48:07 +01:00
|
|
|
|
2020-11-01 20:21:27 +01:00
|
|
|
core = {
|
|
|
|
|
|
|
|
prefix = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "hw-pc-";
|
2020-12-03 12:48:07 +01:00
|
|
|
description = "String prefix signifying the Genode core in use.";
|
2020-11-01 20:21:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
supportedSystems = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
example = [ "i686-genode" "x86_64-genode" ];
|
2020-12-03 12:48:07 +01:00
|
|
|
description = "Hardware supported by this core.";
|
|
|
|
};
|
|
|
|
|
|
|
|
children = mkOption {
|
|
|
|
type = with types;
|
|
|
|
attrsOf (submodule {
|
|
|
|
options = {
|
2021-02-16 12:10:50 +01:00
|
|
|
inherit binary coreROMs extraInputs package;
|
2020-12-03 12:48:07 +01:00
|
|
|
configFile = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
description = ''
|
|
|
|
Set of children at the lowest init level, these children must not
|
|
|
|
have any dependency on a Nix store.
|
|
|
|
Configuration format is a Dhall configuration of type
|
|
|
|
<literal>Genode.Init.Child.Type</literal>.
|
|
|
|
See https://git.sr.ht/~ehmry/dhall-genode/tree/master/Init/Child/Type
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
};
|
2020-11-01 20:21:27 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
boot = {
|
|
|
|
|
|
|
|
configFile = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
description = ''
|
|
|
|
Dhall boot configuration. See
|
|
|
|
https://git.sr.ht/~ehmry/dhall-genode/tree/master/Boot/package.dhall
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
image = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
description =
|
|
|
|
"Boot image containing the base component binaries and configuration.";
|
|
|
|
};
|
|
|
|
|
|
|
|
romModules = mkOption {
|
|
|
|
type = types.attrsOf types.path;
|
2020-12-03 12:48:07 +01:00
|
|
|
default = { };
|
2020-11-01 20:21:27 +01:00
|
|
|
description = "Attr set of initial ROM modules";
|
|
|
|
};
|
|
|
|
|
2020-12-03 12:48:07 +01:00
|
|
|
storeFsUuid = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = import ./store-fs-uuid;
|
|
|
|
description = "Custom partition type of the nix-store file-system.";
|
|
|
|
};
|
|
|
|
|
|
|
|
storePartUuid = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = import ./partition-type;
|
|
|
|
description = "Custom partition type of the nix-store file-system.";
|
|
|
|
};
|
|
|
|
|
|
|
|
storeBackend = mkOption {
|
2021-02-01 13:32:05 +01:00
|
|
|
type = types.enum [ "fs" "memory" ]; # "parent"?
|
|
|
|
default = "memory";
|
2020-12-03 12:48:07 +01:00
|
|
|
description = ''
|
|
|
|
Backend for the initial /nix/store file-system.
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2021-02-01 13:32:05 +01:00
|
|
|
<term>
|
|
|
|
<literal>fs</literal>
|
|
|
|
</term>
|
2020-12-03 12:48:07 +01:00
|
|
|
<listitem>
|
2021-02-01 13:32:05 +01:00
|
|
|
<para>Store backed by a File_system session.</para>
|
2020-12-03 12:48:07 +01:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2021-02-01 13:32:05 +01:00
|
|
|
<term>
|
|
|
|
<literal>tarball</literal>
|
|
|
|
</term>
|
2020-12-03 12:48:07 +01:00
|
|
|
<listitem>
|
2021-02-01 13:32:05 +01:00
|
|
|
<para>An in-memory tarball.</para>
|
2020-12-03 12:48:07 +01:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
storePaths = mkOption {
|
2021-03-02 17:45:54 +01:00
|
|
|
type = with types; listOf path;
|
2020-12-03 12:48:07 +01:00
|
|
|
description = ''
|
|
|
|
Derivations to be included in the Nix store in the generated boot image.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-11-01 20:21:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-02-16 12:10:50 +01:00
|
|
|
config = {
|
2020-11-01 20:21:27 +01:00
|
|
|
|
|
|
|
assertions = [{
|
2021-01-05 15:11:42 +01:00
|
|
|
assertion = builtins.any (s:
|
|
|
|
s == config.nixpkgs.system || s == config.nixpkgs.crossSystem.system)
|
2020-11-01 20:21:27 +01:00
|
|
|
config.genode.core.supportedSystems;
|
|
|
|
message = "invalid Genode core for this system";
|
|
|
|
}];
|
|
|
|
|
2021-02-16 12:10:50 +01:00
|
|
|
genode.boot.romModules = with builtins;
|
|
|
|
let getBin = name: "${getAttr name pkgs.genodePackages}/bin/${name}";
|
|
|
|
in listToAttrs (lib.lists.flatten
|
|
|
|
((map (getAttr "roms") (attrValues children')) ++ (map
|
|
|
|
({ cap, path, ... }: {
|
|
|
|
name = cap;
|
|
|
|
value = path;
|
|
|
|
}) (attrValues coreErisCaps)))) // {
|
|
|
|
"init" = "${pkgs.genodePackages.init}/bin/init";
|
|
|
|
"report_rom" = "${pkgs.genodePackages.report_rom}/bin/report_rom";
|
|
|
|
};
|
2021-02-03 20:39:25 +01:00
|
|
|
|
2020-12-03 12:48:07 +01:00
|
|
|
genode.core.children =
|
2021-02-01 15:36:29 +01:00
|
|
|
# Component to steer the main fs to a specific partition
|
2021-02-01 13:32:05 +01:00
|
|
|
(if config.genode.boot.storeBackend != "memory" then {
|
2021-02-16 15:25:30 +01:00
|
|
|
part_block = {
|
2021-02-16 12:10:50 +01:00
|
|
|
package = pkgs.genodePackages.part_block;
|
2021-02-16 15:25:30 +01:00
|
|
|
configFile = pkgs.writeText "part_block.dhall" ''
|
2020-12-03 12:48:07 +01:00
|
|
|
let Genode = env:DHALL_GENODE
|
|
|
|
|
|
|
|
let Init = Genode.Init
|
|
|
|
|
2021-02-16 15:25:30 +01:00
|
|
|
in λ(binary : Text) -> Init.Child.flat
|
2020-12-03 12:48:07 +01:00
|
|
|
Init.Child.Attributes::{
|
2021-02-16 15:25:30 +01:00
|
|
|
, binary
|
|
|
|
, resources = Init.Resources::{ ram = Genode.units.MiB 8 }
|
2020-12-03 12:48:07 +01:00
|
|
|
, config = Init.Config::{
|
2021-02-16 15:25:30 +01:00
|
|
|
, attributes = toMap { ignore_mbr = "yes" }
|
2020-12-03 12:48:07 +01:00
|
|
|
, policies =
|
|
|
|
[ Init.Config.Policy::{
|
2021-02-16 15:25:30 +01:00
|
|
|
, service = "Block"
|
|
|
|
, label = Init.LabelSelector.prefix "fs"
|
|
|
|
, attributes = toMap
|
|
|
|
{ partition = "${
|
|
|
|
toString config.fileSystems."/".block.partition
|
|
|
|
}"
|
|
|
|
, writeable = "yes"
|
|
|
|
, TODO = "select by partition UUID"
|
|
|
|
}
|
2020-12-03 12:48:07 +01:00
|
|
|
}
|
2021-02-16 15:25:30 +01:00
|
|
|
]
|
2020-12-03 12:48:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
2021-02-16 15:25:30 +01:00
|
|
|
} else
|
|
|
|
{ }) // {
|
|
|
|
fs = {
|
2021-02-16 12:10:50 +01:00
|
|
|
package = pkgs.genodePackages.vfs;
|
2021-03-02 23:09:07 +01:00
|
|
|
extraErisInputs =
|
|
|
|
lib.optional (config.genode.boot.storeBackend == "memory")
|
|
|
|
pkg.genodePackages.rump;
|
2021-02-16 15:25:30 +01:00
|
|
|
configFile = let
|
|
|
|
vfsConfig = if config.genode.boot.storeBackend == "memory" then ''
|
|
|
|
VFS.vfs
|
|
|
|
[ VFS.leafAttrs
|
|
|
|
"tar"
|
|
|
|
(toMap { name = "${tarball}" })
|
|
|
|
]
|
|
|
|
'' else
|
|
|
|
let
|
|
|
|
rumpExt2 = ''
|
|
|
|
VFS.vfs
|
|
|
|
[ VFS.leafAttrs
|
|
|
|
"plugin"
|
|
|
|
( toMap
|
|
|
|
{ load = "${pkgs.genodePackages.rump}/lib/vfs_rump.lib.so"
|
|
|
|
, fs = "ext2fs"
|
|
|
|
, ram = "12M"
|
|
|
|
}
|
|
|
|
)
|
|
|
|
]
|
|
|
|
'';
|
|
|
|
in {
|
|
|
|
ahci = rumpExt2;
|
|
|
|
usb = rumpExt2;
|
|
|
|
}.${config.fileSystems."/".block.driver};
|
|
|
|
|
|
|
|
storeResources = let
|
|
|
|
rumpExt2 =
|
|
|
|
"Init.Resources::{ caps = 256, ram = Genode.units.MiB 16 }";
|
|
|
|
in {
|
|
|
|
fs = rumpExt2;
|
|
|
|
memory = "Init.Resources.default";
|
|
|
|
}.${config.genode.boot.storeBackend};
|
|
|
|
|
|
|
|
persistencePolicies = lib.mapAttrsToList (name: _: ''
|
|
|
|
, Init.Config.Policy::{
|
|
|
|
, service = "File_system"
|
|
|
|
, label = Genode.Init.LabelSelector.prefix
|
|
|
|
"nixos -> ${name}"
|
|
|
|
, attributes = toMap { root = "/services", writeable = "yes" }
|
|
|
|
}
|
|
|
|
'') (filterAttrs (_: child: child.fsPersistence)
|
|
|
|
config.genode.init.children);
|
|
|
|
|
|
|
|
fsPolicies = map (name: ''
|
|
|
|
, Init.Config.Policy::{
|
|
|
|
, service = "File_system"
|
|
|
|
, label =
|
|
|
|
Init.LabelSelector.Type.Partial
|
|
|
|
{ prefix = Some "nixos -> ${name}", suffix = Some "nix-store" }
|
|
|
|
, attributes = toMap { root = "/nix/store", writeable = "no" }
|
|
|
|
}
|
|
|
|
'') (builtins.attrNames config.genode.init.children);
|
|
|
|
|
|
|
|
in pkgs.writeText "fs.dhall" ''
|
|
|
|
let Genode = env:DHALL_GENODE
|
|
|
|
|
|
|
|
let Init = Genode.Init
|
|
|
|
|
|
|
|
let VFS = Genode.VFS
|
|
|
|
|
|
|
|
let persistencePolicies = [ ${
|
|
|
|
toString persistencePolicies
|
|
|
|
} ] : List Init.Config.Policy.Type
|
|
|
|
|
|
|
|
let fsPolicies = [ ${
|
|
|
|
toString fsPolicies
|
|
|
|
} ] : List Init.Config.Policy.Type
|
|
|
|
|
|
|
|
in λ(binary : Text) -> Init.Child.flat
|
|
|
|
Init.Child.Attributes::{
|
|
|
|
, binary
|
|
|
|
, resources = ${storeResources}
|
|
|
|
, provides = [ "File_system" ]
|
|
|
|
, config = Init.Config::{
|
|
|
|
, content = [ ${vfsConfig} ]
|
|
|
|
, policies =
|
|
|
|
[ Init.Config.Policy::{
|
|
|
|
, service = "File_system"
|
|
|
|
, label = Init.LabelSelector.prefix "store_rom"
|
|
|
|
, attributes = toMap { root = "/" }
|
|
|
|
}
|
|
|
|
] # persistencePolicies # fsPolicies
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2020-12-03 12:48:07 +01:00
|
|
|
|
2021-02-16 12:10:50 +01:00
|
|
|
# genode.boot.storePaths = builtins.attrValues romDirectories;
|
2020-11-10 15:49:12 +01:00
|
|
|
|
2021-02-16 12:10:50 +01:00
|
|
|
genode.boot.configFile = bootConfigFile;
|
2020-12-03 12:48:07 +01:00
|
|
|
|
2020-11-01 20:21:27 +01:00
|
|
|
# Create the tarball of the store to live in core ROM
|
|
|
|
system.build.tarball =
|
|
|
|
pkgs.callPackage "${modulesPath}/../lib/make-system-tarball.nix" {
|
2021-02-16 12:10:50 +01:00
|
|
|
extraInputs = lib.attrsets.mapAttrsToList (name: child: child.package)
|
|
|
|
config.genode.init.children;
|
|
|
|
contents = erisContents;
|
2020-11-01 20:21:27 +01:00
|
|
|
compressCommand = "cat";
|
|
|
|
compressionExtension = "";
|
|
|
|
};
|
|
|
|
|
|
|
|
system.build.initXml = pkgs.buildPackages.runCommand "init.xml" {
|
2020-11-07 18:46:35 +01:00
|
|
|
nativeBuildInputs = with pkgs.buildPackages; [ dhall xorg.lndir libxml2 ];
|
2020-11-01 20:21:27 +01:00
|
|
|
DHALL_GENODE = "${pkgs.genodePackages.dhallGenode}/binary.dhall";
|
|
|
|
} ''
|
|
|
|
export XDG_CACHE_HOME=$NIX_BUILD_TOP
|
|
|
|
lndir -silent \
|
|
|
|
${pkgs.genodePackages.dhallGenode}/.cache \
|
|
|
|
$XDG_CACHE_HOME
|
2021-02-16 12:10:50 +01:00
|
|
|
dhall text <<< "(env:DHALL_GENODE).Init.render (${bootConfigFile}).config" > $out
|
2020-11-07 18:46:35 +01:00
|
|
|
xmllint --noout $out
|
2020-11-01 20:21:27 +01:00
|
|
|
'';
|
|
|
|
|
2020-12-30 21:07:30 +01:00
|
|
|
virtualisation.diskImage = let
|
2020-12-03 12:48:07 +01:00
|
|
|
espImage = import ./lib/make-esp-fs.nix { inherit config pkgs; };
|
2021-02-16 12:10:50 +01:00
|
|
|
storeFsImage = pkgs.callPackage ./lib/make-ext2-fs.nix {
|
|
|
|
inherit config lib pkgs;
|
|
|
|
contents = erisContents;
|
|
|
|
};
|
2020-12-03 12:48:07 +01:00
|
|
|
bootDriveImage = import ./lib/make-bootable-image.nix {
|
|
|
|
inherit config pkgs espImage storeFsImage;
|
|
|
|
};
|
2021-02-01 13:32:05 +01:00
|
|
|
in lib.mkIf (config.genode.boot.storeBackend != "memory") bootDriveImage;
|
2020-12-03 12:48:07 +01:00
|
|
|
|
2021-02-01 13:32:05 +01:00
|
|
|
virtualisation.useBootLoader = config.genode.boot.storeBackend != "memory";
|
2020-12-03 12:48:07 +01:00
|
|
|
|
2021-02-16 12:10:50 +01:00
|
|
|
virtualisation.qemu.options = let
|
|
|
|
blockCommon =
|
|
|
|
[ "-bios ${pkgs.buildPackages.buildPackages.OVMF.fd}/FV/OVMF.fd" ];
|
|
|
|
in {
|
|
|
|
fs = blockCommon;
|
|
|
|
memory = [ ];
|
|
|
|
}.${config.genode.boot.storeBackend};
|
2020-12-03 12:48:07 +01:00
|
|
|
|
2020-11-01 20:21:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|