2
0
Fork 0
genodepkgs/tests/nixos-host.nix

86 lines
2.5 KiB
Nix

{ self, localSystem, legacyPackages }:
import "${self.inputs.nixpkgs}/nixos/tests/make-test-python.nix"
({ pkgs, ... }: {
name = "genode-guest";
# meta.maintainers = [ pkgs.lib.maintainers.ehmry ];
machine = {
imports = [
self.nixosModules.genodeGuests
"${self.inputs.nixpkgs}/nixos/modules/profiles/minimal.nix"
];
networking.bridges.br0.interfaces = [ "eth0" "tap0" ];
networking.interfaces.eth0.useDHCP = false;
networking.interfaces.tap0 = {
useDHCP = false;
virtual = true;
virtualType = "tap";
};
genodeGuests.tap-test = {
config = ''
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let XML = Prelude.XML
let Init = Genode.Init
in Init::{
, children = toMap
{ lwip_fs =
Init.Child.flat
Init.Child.Attributes::{
, binary = "vfs"
, config = Init.Config::{
, content =
[ XML.element
{ name = "vfs"
, attributes = XML.emptyAttributes
, content =
[ XML.leaf
{ name = "lwip"
, attributes = toMap { dhcp = "yes" }
}
]
}
]
}
, provides = [ "File_system" ]
, resources = Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 8
}
, routes =
[ Init.ServiceRoute.parentLabel "Nic" (None Text) (Some "tap0")
, Init.ServiceRoute.parent "Timer"
]
}
}
, verbose = True
}
'';
nics = [ "tap0" ];
rom = pkgs: {
"vfs" = "${pkgs.genodeSources.depot "vfs"}/vfs";
"libvfs.so" = "${(pkgs.genodeSources.depot "vfs").lib}/lib/libvfs.so";
"libvfs_lwip.so" =
"${pkgs.genodeSources.depot "vfs_lwip"}/lib/libvfs_lwip.so";
};
};
};
testScript = ''
start_all()
machine.wait_for_unit("tap-test")
machine.wait_for_open_port("1965")
'';
}) { system = localSystem; }