software/console: move console setup to module

This commit is contained in:
Infinidoge 2021-12-03 22:55:24 -05:00
parent 450e497cb4
commit f02c9f0e1b
2 changed files with 38 additions and 16 deletions

View file

@ -0,0 +1,38 @@
{ config, lib, ... }:
with lib;
with lib.hlissner;
let
cfg = config.modules.software.console;
opt = options.modules.software.console;
in
{
options.modules.software.console = with types; {
kmscon = {
enable = mkBoolOpt true;
font = {
size = mkOpt int 14;
font = mkOpt str (head config.modules.locale.fonts.defaults.monospace);
};
extraOptions = mkOpt (separatedString " ") "";
extraConfig = mkOpt lines "";
};
};
config = {
console = {
font = "Lat2-Terminus16";
earlySetup = true;
};
services.kmscon = mkIf cfg.kmscon.enable {
enable = true;
hwRender = true;
extraConfig = ''
font-size=${cfg.kmscon.font.size}
font-name=${cfg.kmscon.font.font}
${opt.kmscon.extraConfig}
'';
extraOptions = mkAliasDefinitions opt.kmscon.extraOptions;
};
};
}