sigil/nixos-modules/hardware/default.nix

82 lines
2.4 KiB
Nix
Raw Normal View History

{ config, pkgs, lib, ... }:
with lib;
{
2020-12-30 21:07:30 +01:00
imports = [ ./ahci.nix ./framebuffer.nix ./nic.nix ./usb.nix ];
options.hardware.genode.platform.policies = lib.mkOption {
type = with types; listOf path;
default = [ ];
description = ''
List of policies to append to the Genode platform driver.
Type is Init.Config.Policy.Type.
'';
};
config = {
2020-12-30 21:07:30 +01:00
genode.core.children.acpi_drv = {
binary = "${pkgs.genodePackages.acpi_drv}/bin/acpi_drv";
configFile = pkgs.writeText "acpi_drv.dhall" ''
let Genode = env:DHALL_GENODE
let Init = Genode.Init
let label = λ(_ : Text) { local = _, route = _ }
in λ(binary : Text)
Init.Child.flat
Init.Child.Attributes::{
, binary
, resources = Init.Resources::{
, caps = 400
, ram = Genode.units.MiB 4
, constrainPhys = True
}
, romReports = [ label "acpi", label "smbios_table" ]
, routes =
[ Init.ServiceRoute.parent "IRQ"
, Init.ServiceRoute.parent "IO_MEM"
, Init.ServiceRoute.parent "IO_PORT"
]
}
'';
};
2020-12-30 21:07:30 +01:00
genode.core.children.platform_drv = {
binary = "${pkgs.genodePackages.platform_drv}/bin/platform_drv";
configFile = let
policies =
map (policy: ", ${policy}") config.hardware.genode.platform.policies;
in pkgs.writeText "platform_drv.dhall" ''
let Genode = env:DHALL_GENODE
let Init = Genode.Init
in λ(binary : Text) -> Init.Child.flat
Init.Child.Attributes::{
, binary
, resources = Init.Resources::{
, caps = 800
, ram = Genode.units.MiB 4
, constrainPhys = True
}
, reportRoms = let label = "acpi" in [ { local = label, route = label } ]
, provides = [ "Platform" ]
, routes =
[ Init.ServiceRoute.parent "IRQ"
, Init.ServiceRoute.parent "IO_MEM"
, Init.ServiceRoute.parent "IO_PORT"
]
, config = Init.Config::{
, policies = [ ${toString policies} ]
}
}
'';
};
};
}