nixos-modules: convert romModules to list

This commit is contained in:
Ehmry - 2022-05-24 15:57:53 -05:00
parent 20281a8420
commit d6022ce707
3 changed files with 37 additions and 26 deletions

View File

@ -70,8 +70,8 @@ let
(with pkgs.genodePackages; storeBackendInputs ++ coreInputs))
+ lib.optionalString (config.genode.core.romModules != { }) ''
# [ { mapKey = "romModules", mapValue = [ ${
lib.concatStringsSep ", " (lib.lists.flatten ((mapAttrsToList
(k: v: ''{ mapKey = "${k}", mapValue = "${v}" }'')
lib.concatStringsSep ", " (lib.lists.flatten ((map ({ name, value }:
''{ mapKey = "${name}", mapValue = "${value}" }'')
config.genode.core.romModules)))
}] } ]'');
@ -115,9 +115,9 @@ let
EOF
'';
erisContents = lib.attrsets.mapAttrsToList (urn: source: {
target = urn;
inherit source;
erisContents = map ({ name, value }: {
target = name;
source = value;
}) config.genode.init.romModules;
in {
@ -177,8 +177,8 @@ in {
};
romModules = mkOption {
type = types.attrsOf types.path;
default = { };
type = with lib.types; listOf (attrsOf str);
default = [ ];
description = "Attr set of initial ROM modules";
};
@ -230,15 +230,20 @@ in {
}];
genode.core.romModules = with builtins;
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";
};
(lib.lists.flatten ((map (getAttr "roms") (attrValues children')) ++ (map
({ cap, path, ... }: {
name = cap;
value = path;
}) (attrValues coreErisCaps)))) ++ [
{
name = "init";
value = "${pkgs.genodePackages.init}/bin/init";
}
{
name = "report_rom";
value = "${pkgs.genodePackages.report_rom}/bin/report_rom";
}
];
genode.core.children.jitter_sponge = {
package = pkgs.genodePackages.jitter_sponge;
@ -266,8 +271,8 @@ in {
system.build.configFile = bootConfigFile;
# Create the tarball of the store to live in core ROM
system.build.tarball =
pkgs.buildPackages.callPackage "${modulesPath}/../lib/make-system-tarball.nix" {
system.build.tarball = pkgs.buildPackages.callPackage
"${modulesPath}/../lib/make-system-tarball.nix" {
extraInputs = lib.attrsets.mapAttrsToList (_: child: child.package)
config.genode.init.children;
contents = erisContents;

View File

@ -77,8 +77,8 @@ in {
};
romModules = mkOption {
type = types.attrsOf types.path;
default = { };
type = with lib.types; listOf (attrsOf str);
default = [ ];
description = "Attr set of initial ROM modules";
};
@ -121,8 +121,8 @@ in {
'';
romModules = with builtins;
listToAttrs (lib.lists.flatten
(map ({ roms, ... }: roms) (lib.lists.flatten (attrValues children'))));
lib.lists.flatten
(map ({ roms, ... }: roms) (lib.lists.flatten (attrValues children')));
};

View File

@ -26,10 +26,16 @@ in {
genode.core.image =
utils.novaImage config.system.name { } config.system.build.configFile;
genode.core.romModules = {
"ld.lib.so" = "${pkgs.genodePackages.base-nova}/lib/ld.lib.so";
timer_drv = "${pkgs.genodePackages.base-nova}/bin/timer_drv";
};
genode.core.romModules = [
{
name = "ld.lib.so";
value = "${pkgs.genodePackages.base-nova}/lib/ld.lib.so";
}
{
name = "timer_drv";
value = "${pkgs.genodePackages.base-nova}/bin/timer_drv";
}
];
genode.core.storePaths =
lib.optional (config.genode.core.storeBackend != "memory") bootDir;