diff --git a/nixos-modules/genode-core.nix b/nixos-modules/genode-core.nix index 0a243d2..9e7b298 100644 --- a/nixos-modules/genode-core.nix +++ b/nixos-modules/genode-core.nix @@ -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; diff --git a/nixos-modules/genode-init.nix b/nixos-modules/genode-init.nix index 5799a1e..4d1da45 100644 --- a/nixos-modules/genode-init.nix +++ b/nixos-modules/genode-init.nix @@ -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'))); }; diff --git a/nixos-modules/nova.nix b/nixos-modules/nova.nix index b9d362f..b8ba5ee 100644 --- a/nixos-modules/nova.nix +++ b/nixos-modules/nova.nix @@ -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;