2
0
Fork 0
Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

111 lines
3.0 KiB

{ config, pkgs, lib, ... }:
with lib;
let
inputs = mkOption {
description = "List of packages to build a ROM store with.";
type = types.listOf types.package;
};
in {
options.genode.init = {
inherit inputs;
configFile = mkOption {
description = ''
Dhall configuration of this init instance after children have been merged.
'';
type = types.path;
};
baseConfig = mkOption {
description =
"Dhall configuration of this init instance before merging children.";
type = types.str;
default = ''
let Genode = env:DHALL_GENODE
in Genode.Init::{
, routes =
[ Genode.Init.ServiceRoute.parent "File_system"
, Genode.Init.ServiceRoute.parent "Rtc"
, Genode.Init.ServiceRoute.parent "Timer"
, Genode.Init.ServiceRoute.parent "IRQ"
, Genode.Init.ServiceRoute.parent "IO_MEM"
, Genode.Init.ServiceRoute.parent "IO_PORT"
]
}
'';
};
children = mkOption {
default = { };
type = with types;
attrsOf (submodule {
options = {
inherit inputs;
configFile = mkOption {
type = types.path;
description = ''
Dhall configuration of child.
See https://git.sr.ht/~ehmry/dhall-genode/tree/master/Init/Child/Type
'';
};
};
});
};
subinits = mkOption {
default = { };
type = with types;
attrsOf (submodule {
options = {
inherit inputs;
configFile = mkOption {
type = types.path;
description = ''
Dhall configuration of child init.
See https://git.sr.ht/~ehmry/dhall-genode/tree/master/Init/Type
'';
};
};
});
};
};
config = {
genode.init.inputs = with builtins;
[ pkgs.genodePackages.report_rom ] ++ concatLists (catAttrs "inputs"
((attrValues config.genode.init.children)
++ (attrValues config.genode.init.subinits)));
# TODO: convert the subinits to children
genode.init.configFile = pkgs.writeText "init.dhall" ''
let Genode = env:DHALL_GENODE
let baseConfig = ${config.genode.init.baseConfig}
in baseConfig with children = baseConfig.children # toMap {${
concatMapStrings (name:
", `${name}` = (${
config.genode.init.children.${name}.configFile
} : Genode.Init.Child.Type)")
(builtins.attrNames config.genode.init.children)
} ${
concatMapStrings (name: ''
, `${name}` =
Genode.Init.toChild
(${
config.genode.init.subinits.${name}.configFile
} : Genode.Init.Type)
Genode.Init.Attributes.default
'') (builtins.attrNames config.genode.init.subinits)
} }
'';
};
}