sigil/nixos-modules/hardware/framebuffer.nix
Emery Hemingway 8379dccf12 Refer to program and library ROMs by store path
Retrieve ROMs in the common case by full store path. This reduces
the need for route policies for driving relative requests into
absolute package paths.

Making library requests by absolute path required libraries to be
stored in the core image as such, and it follows that program
binaries should be handled in the same way. This makes requests
to core and to a file-system store more consistent, and makes
dependency detection more robust.
2021-02-16 15:46:14 +01:00

53 lines
1.3 KiB
Nix

{ config, pkgs, lib, ... }:
with lib;
{
options.hardware.genode.framebuffer = {
enable = lib.mkEnableOption "framebuffer driver";
driver = mkOption {
type = types.enum [ "boot" "vesa" ];
default = "vesa";
};
};
config = {
genode.core.children.fb_drv = mkIf config.hardware.genode.framebuffer.enable
(let
binary = with pkgs.genodePackages;
{
boot = boot_fb_drv;
vesa = vesa_drv;
}.${config.hardware.genode.framebuffer.driver};
in {
inputs = [ binary ];
configFile = let
binary = with pkgs.genodePackages;
{
boot = "${boot_fb_drv}/bin/boot_fb_drv";
vesa = "${vesa_drv}/bin/vesa_fb_drv";
}.${config.hardware.genode.framebuffer.driver};
in builtins.toFile "fb_drv.dhall" ''
let Genode = env:DHALL_GENODE
let XML = Genode.Prelude.XML
let Init = Genode.Init
in Init.Child.flat
Init.Child.Attributes::{
, binary = "${binary}"
, resources = Init.Resources::{ caps = 256, ram = Genode.units.MiB 32 }
, routes =
[ Init.ServiceRoute.parent "IO_MEM"
, Init.ServiceRoute.parent "IO_PORT"
]
}
'';
});
};
}