parent
ffa45d7d2b
commit
ee580c30e2
11
flake.nix
11
flake.nix
|
@ -61,21 +61,12 @@
|
|||
inherit packages;
|
||||
};
|
||||
|
||||
nixosModule = ./nixos;
|
||||
|
||||
checks = (import ./tests {
|
||||
checks = import ./tests {
|
||||
inherit system localSystem crossSystem;
|
||||
apps = dhall-haskell.apps.${localSystem} // apps;
|
||||
inherit self nixpkgs genode-depot;
|
||||
inherit lib;
|
||||
genodepkgs = thisSystem self.packages;
|
||||
}) // {
|
||||
nixos = import ./nixos/test.nix {
|
||||
system = localSystem;
|
||||
depot = genode-depot;
|
||||
genodepkgs = self;
|
||||
inherit nixpkgs;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
options.genode = with lib;
|
||||
let
|
||||
genodeOpts = { ... }: {
|
||||
options = {
|
||||
|
||||
name = mkOption {
|
||||
example = "webserver";
|
||||
type = types.str;
|
||||
description = "Name of the Genode subsystem.";
|
||||
};
|
||||
|
||||
pkgs = mkOption {
|
||||
type = with types; attrsOf package;
|
||||
description = ''
|
||||
Attribute set of Genode packages.
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkOption {
|
||||
type = types.str;
|
||||
default = "<config/>";
|
||||
description = ''
|
||||
Configuration of the Genode subsystem.
|
||||
Must be rendering in the Genode XML format.
|
||||
'';
|
||||
};
|
||||
|
||||
rom = mkOption {
|
||||
type = with types; attrs;
|
||||
example = literalExample {
|
||||
nic_drv = "${genode-depot.ipxe_nic_drv}/bin/ipxe_nic_drv";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
in mkOption {
|
||||
type = with lib.types; loaOf (submodule genodeOpts);
|
||||
default = { };
|
||||
example = {
|
||||
foobar = {
|
||||
config = "<empty/>";
|
||||
rom = { };
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Configurations of Genode subsystems
|
||||
'';
|
||||
};
|
||||
|
||||
config = {
|
||||
|
||||
systemd.services = let
|
||||
toService = name: cfg: {
|
||||
description = "Genode subsystem";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
preStart = let
|
||||
rom' = with cfg.pkgs.genode;
|
||||
{
|
||||
core = "${base-linux}/bin/core-linux";
|
||||
init = "${os}/bin/init";
|
||||
"ld.lib.so" = "${base-linux}/bin/ld.lib.so";
|
||||
timer = "${base-linux}/bin/linux_timer_drv";
|
||||
config = builtins.toFile "${name}.config.xml" cfg.config;
|
||||
} // cfg.rom;
|
||||
in builtins.concatStringsSep "\n"
|
||||
(lib.mapAttrsToList (name: value: "ln -s ${value} ${name}") rom');
|
||||
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
RuntimeDirectory = "genode/" + name;
|
||||
WorkingDirectory = "/run/genode/" + name;
|
||||
ExecStart = "${cfg.pkgs.genode.base-linux}/bin/core-linux";
|
||||
};
|
||||
};
|
||||
in lib.mapAttrs toService config.genode;
|
||||
|
||||
};
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
{ system, depot, genodepkgs, nixpkgs, }:
|
||||
|
||||
import "${nixpkgs}/nixos/tests/make-test.nix" (
|
||||
|
||||
{ ... }:
|
||||
|
||||
rec {
|
||||
name = "genode-base-linux";
|
||||
|
||||
machine =
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
flakePackages = flake:
|
||||
with builtins;
|
||||
getAttr config.nixpkgs.system (getAttr "packages" flake);
|
||||
in {
|
||||
imports = [ "${genodepkgs}/nixos" ];
|
||||
genode = {
|
||||
signal-test = rec {
|
||||
config = ''
|
||||
<config>
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="RM"/>
|
||||
<service name="PD"/>
|
||||
<service name="LOG"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<default caps="100"/>
|
||||
<start name="timer" caps="96">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
<start name="test-signal" caps="500">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
</start>
|
||||
</config>
|
||||
'';
|
||||
pkgs = flakePackages genodepkgs;
|
||||
rom = {
|
||||
"test-signal" =
|
||||
"${pkgs.genode.os}/bin/test-signal";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
$machine->waitUntilSucceeds("journalctl -u signal-test | grep -q -i -- '--- Signalling test finished ---'");
|
||||
'';
|
||||
|
||||
}) { inherit system; }
|
Loading…
Reference in New Issue