1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 11:03:37 +03:00
mobile-nixos/modules/initrd-framebuffer.nix
Samuel Dionne-Riel f40c8c1f08 modules: use types.str over types.string...
types.string having been formally deprecated, and having a likely
unwanted behaviour.
2019-09-18 15:28:51 -04:00

51 lines
1.3 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
with import ./initrd-order.nix;
let
cfg = config.mobile.boot.stage-1.framebuffer;
stage-1 = config.mobile.boot.stage-1;
in
{
options.mobile.boot.stage-1.framebuffer = {
enable = mkOption {
type = types.bool;
default = true;
description = ''
Enables framebuffer setup.
'';
};
initialization = mkOption {
type = types.str;
default = ''
[ -e "/sys/class/graphics/fb0/modes" ] || return
[ -z "$(cat /sys/class/graphics/fb0/mode)" ] || return
_mode="$(cat /sys/class/graphics/fb0/modes)"
echo "Setting framebuffer mode to: $_mode"
echo "$_mode" > /sys/class/graphics/fb0/mode
'';
description = ''
Commands to initialize the framebuffer.
This is the lower-level initialization.
See `stage-1.initFramebuffer` for additionnal commands, when
implementing quirks and hacks on-top of this.
'';
};
};
config.mobile.boot.stage-1 = lib.mkIf cfg.enable {
init = lib.mkOrder FRAMEBUFFER_INIT ''
set_framebuffer_mode() {
${cfg.initialization}
${
# Start tools like msm-fb-refresher
lib.optionalString (stage-1 ? initFramebuffer) stage-1.initFramebuffer
}
}
set_framebuffer_mode
'';
};
}