1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 19:23:01 +03:00
mobile-nixos/modules/initrd-fbterm.nix
Linus Heckemann 2b300b302f initrd: add fbterm module
Requires a cross-compilation fix for fbterm (nixos/nixpkgs#72107).

This may stop the display-manager from starting correctly, I think it
prevents X from automatically switching to the correct vt. Requires
some further investigation :)
2019-11-16 18:22:49 +01:00

53 lines
1.2 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
with import ./initrd-order.nix;
let
device_name = config.mobile.device.name;
cfg = config.mobile.boot.stage-1.fbterm;
fontsConf = pkgs.writeText "fonts.conf" ''
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<cachedir>/var/cache/fontconfig</cachedir>
<dir>${pkgs.terminus_font}</dir>
</fontconfig>
'';
in
{
options.mobile.boot.stage-1.fbterm = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Enables fbterm.
'';
};
fb = mkOption {
type = types.str;
default = "/dev/fb1";
description = ''
framebuffer to run fbterm on.
'';
};
};
config.mobile.boot.stage-1 = lib.mkIf cfg.enable {
init = lib.mkOrder AFTER_FRAMEBUFFER_INIT ''
(
touch /init.log
echo "Starting fbterm!"
env FB=${cfg.fb} fbterm -n terminus -s 32 </dev/tty1 -- tail -n 200 -f /init.log &
echo "Started fbterm!"
)
'';
extraUtils = with pkgs; [
{ package = fbterm; }
];
contents = [
{ object = fontsConf; symlink = "/etc/fonts/fonts.conf"; }
];
};
}